How do I programmatically set an application bundle on Mac OS X to run when the user logs in?
Basically, the equivalent of the HKCU\Software\Microsoft\Windows\CurrentVersion\Run registry key in Windows.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can add the application to the user’s “Login Items” (under System Preferences=>Accounts=[user]) or you can add a launchd agent to the user’s
~/Library/LaunchAgentsfolder (seeman launchd.plist). Use~/Library/LaunchDaemons/if your app has no user-facing UI. As others point out, launchd gives you a lot of control over when the app starts, what happens if the app quits or crashes, etc. and is most appropriate for “daemon” style apps (with our without UI).The first option (Login Items) can be manipulated programmatically (link from Gordon).