Skip to main content
Question

Edit com.apple.loginitems.plist

  • November 18, 2011
  • 1 reply
  • 7 views

Forum|alt.badge.img+16

I need to delete an item in the com.apple.loginitems.plist file in the /LIbrary/Preferences/ directory for most of my users that has gotten in there erroneously. I have added items to plist files via script before. I have edited items before. But those have been uniquely named items with a boolean value that I could simply add or change. This is different. Below is the object as it appears in the plist file, which I made a copy of and copied to my Desktop.:
<dict> <key>Alias</key> <data> AAAAAADsAAMAAQAAyPoOCQAASCsAAAAAAAAOvQAADusA AMnOWDEAAAAACSD//gAAAAAAAAAA/////wABABgAAA69 AAAOvAAAED0AAAhQAAAApQAAAKQADgAUAAkAUgBlAHMA bwB1AHIAYwBlAHMADwAaAAwATQBhAGMAaQBuAHQAbwBz AGgAIABIAEQAEgBMcHJpdmF0ZS92YXIvcm9vdC8uVHJh c2gvU3ltYW50ZWMgRW5kcG9pbnQgUHJvdGVjdGlvbi5t cGtnL0NvbnRlbnRzL1Jlc291cmNlcwATAAEvAAAVAAIA Ef//AAA </data> <key>CustomItemProperties</key> <dict> <key>com.apple.loginitem.legacyprefs</key> <dict> <key>AliasData</key> <data> AAAAAADYAAMAAAAAyPoOCQAASCsA AAAAAAALUQAADusAAMkAiDgAAAAA CSD//gAAAAAAAAAA/////wABABAA AAtRAAcY9wAGv8cABr/DAA4AKAAT AFUAcABkAGEAdABlAF8ARABZAEwA RAAuAGMAbwBtAG0AYQBuAGQADwAa AAwATQBhAGMAaQBuAHQAbwBzAGgA IABIAEQAEgAscHJpdmF0ZS92YXIv cm9vdC9EZXNrdG9wL1VwZGF0ZV9E WUxELmNvbW1hbmQAEwABLwAAFQAC ABH//wAA </data> <key>Hide</key> <false/> <key>Path</key> <string>/private/var/root/Desktop/Update_DYLD.command</string> </dict> </dict> <key>Icon</key> <data> SW1nUgAAABwAAAAAU1lTTAAAABAAAAAAZmxkcg= </data> <key>Name</key> <string>Resources</string> </dict>

File name: com.apple.loginitems-copy.plist
Test location: My local Desktop

I ran the command "defaults delete /Users/kcecil/Desktop/com.apple.loginitems-copy" with several different keys–com.apple.loginitem.legacyprefs, /private/var/root/Desktop/Update_DYLD.command, and Resources–and never have been able to figure out how to get rid of just this item.

What am I overlooking?

-- Kevin Cecil
Advanced Application Specialist
Technology Division
LifeWay Christian Resources
(615) 251-3949

1 reply

Forum|alt.badge.img+12
  • Contributor
  • November 19, 2011

defaults disappointingly can't handle nested values properly if at all.

Instead you need to use /usr/libexec/PlistBuddy

The command to be run will depend upon the whole plist, not just a snippet. You reference the item by it's postion, 0 being first.

Run /usr/libexec/PlistBuddy -h and have a look at the help. There have been various posts recently using plistbuddy so have a look at those too.

Sean