我正试图通过Apple Remote Desktop设置一个偏好,以便在130个Mac上以32位模式打开Firefox。最简单的方法是使用defaults write
,遗憾的是我没有找到任何关于此的文档,我无法弄清楚编写不在根级别的字符串的语法。
该文件为~/Library/Preferences/com.apple.LaunchServices.plist
我需要将字符串x86_64
更改为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>
答案 0 :(得分:1)
我不认为有一种方法可以使用默认值(嗯,有,但它涉及转储整个LSArchitecturesForX86_64v2字典,编辑它,然后重新导入)。但PlistBuddy可以胜任这项工作:
/usr/libexec/PlistBuddy -c "set :LSArchitecturesForX86_64v2:org.mozilla.firefox:1 i386" ~/Library/Preferences/com.apple.LaunchServices.plist
在向130台计算机部署任何东西之前的常见警告:先测试一下(我试过一次......),然后让它备份每台计算机上的相关文件,这样如果有什么东西横向移动就可以回滚