Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Launch At Login" does not work when App bundle is located outside of /Applications directory #26

Open
gelstudios opened this issue Dec 10, 2020 · 4 comments

Comments

@gelstudios
Copy link
Contributor

gelstudios commented Dec 10, 2020

I ran the app (which works great btw!) from the ~/Downloads directory since safari extracted the zip by default, and later noticed some log spam repeating every few seconds:

Dec 10 09:34:36 kintsugi com.apple.xpc.launchd[1] (dev.vandijk.BrightnessSyncLauncher[59549]): Could not find and/or execute program specified by service: 107: Malformed bundle: dev.vandijk.BrightnessSyncLauncher
Dec 10 09:34:36 kintsugi com.apple.xpc.launchd[1] (dev.vandijk.BrightnessSyncLauncher[59549]): Service exited with abnormal code: 78
Dec 10 09:34:36 kintsugi com.apple.xpc.launchd[1] (dev.vandijk.BrightnessSyncLauncher): Service only ran for 0 seconds. Pushing respawn out by 10 seconds.
Dec 10 09:34:46 kintsugi com.apple.xpc.launchd[1] (dev.vandijk.BrightnessSyncLauncher[59553]): Could not find and/or execute program specified by service: 107: Malformed bundle: dev.vandijk.BrightnessSyncLauncher
Dec 10 09:34:46 kintsugi com.apple.xpc.launchd[1] (dev.vandijk.BrightnessSyncLauncher[59553]): Service exited with abnormal code: 78
Dec 10 09:34:46 kintsugi com.apple.xpc.launchd[1] (dev.vandijk.BrightnessSyncLauncher): Service only ran for 0 seconds. Pushing respawn out by 10 seconds.

I disabled "Launch At Login" on a hunch, and the log messages stopped.

Re-enabled "Launch At Login" and moved the App to /Applications and the log messages did not reappear.

I did notice the App does not appear in System Preferences > Login Items, but also dont know if that has fallen out of style with macos apps 🤓

For reference, another app i use (mos) has a "launch at login" option inside it, and appears in syspref Login Items.
ex: https://github.com/Caldis/Mos/blob/master/Mos/Utils/LaunchStarter.swift

@OCJvanDijk
Copy link
Owner

Good catch. I think it's because the Downloads folder is protected these days so the launcher can't access it.

The API to add your app to System Preferences > Login Items has been deprecated for years now. I was also disappointed when I found out about this. The officially sanctioned way of creating a helper application seems obtuse and not transparent to the user and I never really liked it, but I decided to do it the officially supported way anyway.

@gelstudios
Copy link
Contributor Author

I think you're right about the protected Downloads folder, it works fine if the app is in ~/

@OCJvanDijk
Copy link
Owner

Not really sure how to solve this actually, maybe I should just start distributing the app as one of those fancy DMGs where you can drag it into the Applications folder.

@gelstudios
Copy link
Contributor Author

I've seen a number of apps detect when they are running from a path other than /Applications or ~/Applications and offer to move themselves into the main Applications folder.

examples:
https://discussions.apple.com/thread/8133756
https://support.swiftify.com/hc/en-us/articles/360013074499-Getting-up-and-started-with-the-Offline-Converter-

possible libraries:
https://github.com/potionfactory/LetsMove
https://github.com/OskarGroth/AppMover

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants