I'm making a mac app using atom shell that lives in the menubar. I was wondering what my options would be for getting it to run at startup.
- Does it have to be done manually by the user?
- Do I need permission from the user to do this?
- How would I do it programmatically with node / bash?
- Is there an existing thing within atom shell to do this?
- Is there an existing module that can do this?
Assuming you want this application to launch for each user, as they log on, you would set up the app as a LaunchAgent.
Simply create a plist file that describes what the job is to do and copy the plist to /Library/LaunchAgents.
The plist would be something like this: -
Replace My_executable with the full path to the application (if it's a
.app
, point tomy_application.app/Contents/MacOS/my_binary
) and add command line parameters as required. If atom_shell requires launching a shell, you would use this as the application to run and your script as a command-line parameter.Also ensure you set the label to a unique URI.
Give the auto-launch module a try, it should do what you want. To answer your questions:
You can also create an app directory in side /applications/Atom.app/Content/resources directory of atom and symlink to your files. This will launch your app on startup.
Electron now offers an official API for setting the app to auto-start on Windows and Mac.
http://electron.atom.io/docs/api/app/#appsetloginitemsettingssettings-macos-windows