kriskarth
kriskarth

Reputation:

Autostart Mac application programmatically

We have a cross platform application. The application has a feature to autostart it once the user logs in. How to do this in mac? from within the application. Manually adding it Login Items works but I am looking for how to do it using an API or something similar.

Upvotes: 1

Views: 2823

Answers (2)

Gordon Davisson
Gordon Davisson

Reputation: 125788

If it's a GUI app adding it as a login item is the best way to go. Apple's dev note on the subject lists 3 ways to do this: with the Shared File Lists API, via Apple Events, or with the CFPreferences API.

Upvotes: 3

Carmine Paolino
Carmine Paolino

Reputation: 2849

You have to create a launchd property list file and place it in ~/Library/LaunchAgents or /Library/LaunchAgents, depending if you want the change system-wide or only for the current user.

This guide from Apple will help you accomplish that task.

Upvotes: 4

Related Questions