ServiceManagementModuleMBS.JobBless now working?

Does ServiceManagementModuleMBS.JobBless work in Xojo now? I read a note with the text:

This is currently work in progress and does currently not work.

Of course, I need to use a full app as login item and not a console app.

Could you also add SMAppService (SMAppService | Apple Developer Documentation) when you have some free time?

Where did you quote this from?

And I can put SMAppService on the todo list.

That’s from your examples:

Probably not the very latest version.

Well, the plugin part should work, but I probably didn’t get it to work when I tried it.

I’ll try it and will report back.

Last time we tried it it still didn’t work.

1 Like


It was about a year ago so I’m not sure what, if anything, has changed.

The helper app has a small problem. In current versions of Xojo “.app” shouldn’t be added so that the correct code is:

Dim App As String = CurrentBuildLocation + "/" + CurrentBuildAppName

I’ve built the helper app and copied it with a copy script step into the main app. However, I still get an error:

According to macos - What is CFErrorDomainLaunchd error 2? - Stack Overflow the LaunchAgent can’t be found. But isn’t the key that the Stackoverflow article mentions already in the plist of the helper?

I looked into the MBS sample app using JobBless and found several complications:

  • One cannot use .app as a helper with JobBless. It must be a single executable, and therefore one must build a cmdline tool (which requires a more expensive license, BTW).
  • One must sign both Main and Helper.
  • One must use in order to generate the proper values for SMAuthorizedClients and SMPrivilegedExecutables plist entries.
  • One must insert both the Launchd.plist and Info.plist manually into the compiled and signed Helper executable, which wasn’t possible until yesterday (because they usually must be provided at the time the Linker is used, but Xojo doesn’t provide such options for it). I’ve then fixed an open source tool to make this work: Can now add multiple plists with different section names by tempelmann · Pull Request #1 · gdbinit/gimmedebugah · GitHub
  • Once all that is done, I found out that while JobBless would now work, the Helper app could still not launch because it relies on the attached Libs folder with the xojo framework inside - and that’s not allowed for a blessed app as far as I can tell.
  • Ergo: As long as Xojo is not able to include the framework dylibs inside the executable, this is hopeless.

Apple recommends to use SMAppService. With SMJobBless not working with Xojo I doubt that the new SMAppService would work.

In the meantime they recommend to use AssociatedBundleIdentifiers in the plist of the launchd file. I’ve verified that this works fine.

The new class is written and I can post you a new plugin to try later.

1 Like