How to add login Items by code to mountain lion osx

1

Until I upgraded to Mountain Lion I was able to add login items by editing this plist:

/Users/test/Library/Preferences/loginwindow.plist 

And adding items (path,name,hide) to AutoLaunchedApplicationDictionary dictionary.

In the OS this doesn't work anymore. Items that are added to this dictionary are not launch on login.

I see that the save now the login items in a file called com.apple.loginitems.plist, but I dont undersand how to add an item to this file.

I tried to add the item to CustomListItems dictionary with parameters like name,path, hide, but they were not launched on login.

Does anyone know how can I add from code login item?

Tal

Posted 2012-08-23T07:15:32.050

Reputation: 11

Answers

0

You can still use AppleScript:

osascript -e 'tell app "System Events" to make login item at end with properties {path:"/Applications/iTunes.app", hidden:true}'

Lri

Posted 2012-08-23T07:15:32.050

Reputation: 34 501