I am trying to set a preference for Firefox to open in 32bit mode on 130 macs via Apple Remote Desktop. The easiest way to do this usually is with defaults write
unfortunately I havent found any documention on this, and I cant figure out the syntax for writing a string thats not at the root level.
The file is ~/Library/Preferences/com.apple.LaunchServices.plist
I need to change the string x86_64
to i386
<dict>
<key>LSArchitecturesForX86_64v2</key>
<dict>
<key>org.mozilla.firefox</key>
<array>
<data>
Ym9va2QCAAAAAAQQMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAYAEAAAwAAAABAQAAQXBwbGljYXRpb25zCwAAAAEB
AABGaXJlZm94LmFwcAAIAAAAAQYAAAQAAAAYAAAACAAAAAQDAABq
ix4BAAAAAAgAAAAEAwAAWYNjAQAAAAAIAAAAAQYAADwAAABMAAAA
CAAAAAAEAABBtfgZbgAAABgAAAABAgAAAgAAAAAAAAAPAAAAAAAA
AAAAAAAAAAAAAAAAAAEFAAAMAAAAAQEAAE1hY2ludG9zaCBIRAgA
AAAEAwAAAICcregAAAAIAAAAAAQAAEG0QBQYAAAAJAAAAAEBAAA0
NkFGNUYyOC1DNTExLTM0MEMtQkU1RS1DREYzMTgyQThFOTIYAAAA
AQIAAIEAAAABAAgA7z8AAAEACAAAAAAAAQAAAAEAAAABAQAALwAA
AAQAAAADAwAAAAAAIBkAAAABAQAAL0FwcGxpY2F0aW9ucy9GaXJl
Zm94LmFwcAAAAMwAAAD+////AQAAAAAAAAAQAAAABBAAACwAAAAA
AAAABRAAAFwAAAAAAAAAEBAAAHwAAAAAAAAAIBAAABgAAAAAAAAA
MBAAAEwAAAAAAAAAQBAAAGwAAAAAAAAAAiAAACQBAAAAAAAAECAA
AKQAAAAAAAAAESAAANgAAAAAAAAAEiAAALgAAAAAAAAAEyAAAMgA
AAAAAAAAICAAAAQBAAAAAAAAMCAAAJwAAAAAAAAAAdAAAJwAAAAA
AAAAENAAADABAAAAAAAAAP8AADwBAAAAAAAA
</data>
<string>x86_64</string>
</array>
</dict>
I don't think there's a way to do this with defaults (well, there is, but it involves dumping the entire LSArchitecturesForX86_64v2 dictionary, editing it, then reimporting). But PlistBuddy can do the job:
/usr/libexec/PlistBuddy -c "set :LSArchitecturesForX86_64v2:org.mozilla.firefox:1 i386" ~/Library/Preferences/com.apple.LaunchServices.plist
And the usual caveats before deploying anything to 130 computers: test this first (I tried it, once...), and have it back up the relevant file on each computer so if something does go sideways you can roll it back.