views:

72

answers:

2

I have a program that runs only in the toolbar (w/ time/date, spotlight, etc.) and I want to put an item in the preferences to allow the user to select whether to start my application on the system startup or not. I'm currently lost on where to find some documentation on this. Any links or short code snippets would be much appreciated. Thanks in advance!

+2  A: 

You need to add the app to login items.

See System Startup Programing Topics: Customizing Login and Logout

TechZen
I take "system startup" to not mean "login" ...
Joshua Nozzi
@Joshua Nozzi -- Well, the first sentence of the first content section of the page I linked to starts with "To launch an application each time the user logs in..." so I'm going to say it does.
TechZen
I was referring to the possible meaning if the question directly, not Apple's odd nomenclature in the documentation. It's a valid clarification to ask for. Since he's talking about a menu extra, I'll assume he means a user space headless app, but it's possible there's a background daemon to go with it.
Joshua Nozzi
Thanks a lot, just what I was looking for! I was actually talking about launching it for each individual's login, considering each user may not want to use the app. Sorry for the confusion and thanks again!
Kyle Zaragoza
Just to follow up in case anyone runs across this, there is a step by step walkthrough and code on how to add/remove login items here - http://cocoatutorial.grapewave.com/tag/lssharedfilelist-h/
Kyle Zaragoza
+1  A: 

There are some different solutions to that but Apple wants you to use the launchd(8).

Refer to this one (different section from the already mentioned documentation, since the topic starter asked for 'system startup', not 'when a user logs in') for some further information.

aprodigy