Launch at login

I want an app to launch at login like Skype and others do.

Of course, I can instruct the user to use Right click/Options/Open at login on the dock icon, but what if I want the app not to have a dock icon with NSUIElement = 1 ?

I found this Objective C sample at but the code seems quite long and winded.

I could not find a simple Xojo example in this forum for Mac, nor in the old forum. Christian advised using the LSSharedFileListMBS class but I am still at a loss about how to apply that to launch an app upon startup. And adding an item to /Library/StartupItem by shell requires sudo and besides the discussion never did seem to lead to a solution, I would like to avoid having to prompt the user for his password.

Any pointers will be appreciated.

I use LaunchD Task Scheduler and have had no problems with it yet…

Hi Michael

I use an applescript to do it…

To add login item…

on run {The_Name_Of_MyApp}
tell application “System Events”
make login item at end with properties {path:"/Applications/", kind:application}
end tell
end run

To delete login item…
tell application “System Events”
get the name of every login item

if login item "The_Name_Of_MyApp" exists then
	delete login item "The_Name_Of_MyApp"
	-- else
	-- display dialog "That login item doesn’t exist"
end if

end tell

Call the login Applescript at launch to add it.

Call the delete Applescript at when you are ready to delete it.


In order to respect the Apple Guidelines, you need an helper :

It’s the only way sin 10.7 to have an auto launch of you application when user login-in.

[quote=97581:@Lennox Jacob]I use an applescript to do it…


Thank you. I am afraid this method would not work for the Mac App Store, though. I believe System Events are out of limits.

I though about that, but as this is destined to inexperienced users. Thank you, though.

Anyone have a solution for this that works with MAS apps and doesn’t require 3rd party plugins?

I have been using Valdemar’s solution since this now ancient thread for a MAS app to full satisfaction.

It is not a plugin. All is needed to use it is an open mind.

And MBS plugins.

Oh right. Valdemar uses MBS. Well. I guess you can reverse engineer Valdemar’s project, and do the same without MBS. It is probably possible, although a lot less easy.

If you have time and some tenacity, you will succeed. The technique he used is sanctioned by Apple. You will have some additional work to properly sign all that as well.