
Dec 27, '11 07:30:00AM • Contributed by: jollyroger
defaults write loginwindow AutoLaunchedApplicationDictionary -array-add '{ "Path" = "/path/to/itemname"; "Hide" = 0; }'
Luckily, there's another way to do it that does allow removal of individual items as well as other things.
A nice work-around solution is to instead use the osascript command-line tool to do it with simple AppleScript commands:
Add an item:
osascript -e 'tell application "System Events" to make login item at end with properties {path:"/path/to/itemname", hidden:false}'
osascript -e 'tell application "System Events" to delete login item "itemname"'
osascript -e 'tell application "System Events" to get the name of every login item'
[crarko adds: Note that the easiest way to get the path to the login item 'itemname' may be to open System Preferences » Accounts, click the 'Login Items' tab and then right-click (Ctrl+click) the name of the item. This displays a 'Reveal in Finder' submenu and you can determine the path from that.]