2

I'm trying to modify a system plist in an Platypus script-based app (Mac), though I have a feeling my question may have a more general answer.

The question is: What is the correct Terminal syntax for targeting and modifying the boolean child of a Dictionary key in a plist file?

I tried:

sudo defaults write /private/var/db/launchd.db/com.apple.launchd.peruser.501/overrides.plist com.github.norio-nomura.SIMBL-Agent Disabled -bool false

but it doesn't like -bool with Disabled there..

simbasounds
  • 327
  • 5
  • 13

2 Answers2

2

I managed to solve it by using PlistBuddy instead. PlistBuddy is built into MacOS X 10.5 and above.

I could have used:

/usr/libexec/PlistBuddy -c "set :com.github.norio-nomura.SIMBL-Agent:Disabled bool" /private/var/db/launchd.db/com.apple.launchd.peruser.501/overrides.plist

But it caused an error in the .pkg installer, so I used:

/usr/libexec/PlistBuddy -c "Delete :com.github.norio-nomura.SIMBL-Agent" /private/var/db/launchd.db/com.apple.launchd.peruser.501/overrides.plist

.. and then:

/usr/libexec/PlistBuddy -c "Add :com.github.norio-nomura.SIMBL-Agent:Disabled bool" /private/var/db/launchd.db/com.apple.launchd.peruser.501/overrides.plist

.. right after that which appears to be working.

simbasounds
  • 327
  • 5
  • 13
0

PlistBuddy doesn't require the Type when SET a value

/usr/libexec/PlistBuddy -c "set :com.github.norio-nomura.SIMBL-Agent:Disabled true" /private/var/db/launchd.db/com.apple.launchd.peruser.501/overrides.plist
Mazen Kasser
  • 3,559
  • 2
  • 25
  • 35