OSX 10.8 LoginItems

2019-03-03 01:51发布

问题:

I found this Add app to OSX "Login Items" during a Package Maker installer postflight script but it doesn't appear to work in OSX 10.8?

This is from the other question and works in everything else...

defaults write \
    /Library/Preferences/loginwindow \
    AutoLaunchedApplicationDictionary \
    -array-add '{ "Path" = "/path/to/script"; "Hide" = "0"; }'

How can I add my app to loginItems in OSX Mountain Lion (10.8)?

回答1:

OS X 10.8 is under NDA, we are not at liberty of giving details about it but i can tell you that there is no /Library/Preferences/loginwindow under 10.7 or any other recent OSX version, you should be doing :

defaults write \
    ~/Library/Preferences/loginwindow \
    AutoLaunchedApplicationDictionary \
    -array-add '{ "Path" = "/path/to/script"; "Hide" = "0"; }'

Notice the "~" tilde was missing



回答2:

OS X 10.8 stores login items in com.apple.loginwindow.plist