Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

add a start up item via command line (mac)

How can I add a start up item via command line on a mac? From googling, I know you have to edit ~/Library/Preferences/com.apple.loginitems.plist using defaults write com.apple.loginitems [key] [value] but i'm not sure exactly which things to edit.

like image 521
nightfire Avatar asked Apr 02 '10 00:04

nightfire


2 Answers

defaults write loginwindow AutoLaunchedApplicationDictionary -array-add '{ "Path" = "/Applications/YourAppName.app"; "Hide" = 0; }'
like image 53
Andreas Xenos Avatar answered Oct 14 '22 23:10

Andreas Xenos


On Mac OS X 10.6 Snow Leopard, it is even simpler than that:

sudo launchctl submit -l name_of_startup_item -- command [args]

See man launchctl. On earlier versions, it is recommended that you create a Launch Daemon PLIST file and load/start it with launchctl rather than create a startup item... the startup items are the old school way.

like image 25
Michael Aaron Safyan Avatar answered Oct 14 '22 22:10

Michael Aaron Safyan