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.
defaults write loginwindow AutoLaunchedApplicationDictionary -array-add '{ "Path" = "/Applications/YourAppName.app"; "Hide" = 0; }'
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With