How do you enter data in PlistBuddy

581 Views Asked by At

I am trying to change a data value with PlistBuddy and can't figure it out.

/usr/libexec/PlistBuddy -c "Set :Kernel:Emulate:Cpuid1Mask AAAAAAAAAAAAAAACAAAAAA==" ~/Desktop/test.plist

Instead of writing the data I want, when I view the file, I get: QUFBQUFBQUFBQUFBQUFBQ0FBQUFBQT09

I have played with hex, dec, bin, everything I can think of, but it never writes correctly. I have been searching everywhere, and there's nothing I can find that explains how to do it. Everything is on entering strings, and nothing tells how to enter data, or it's format.

I need to change that value back and forth from AAAAAAAAAAAAAAACAAAAAA== to AAAAAAAAAAAAAAAAAAAAAA==

I tried printing it to see the output, so I could see the format, but it's blank in terminal.

Anyone know how to do it?

2

There are 2 best solutions below

1
Fred Leonard On

I figured it out. Both defaults and PlistBuddy cannot do it. plutil works fine without corrupting the data string.

0
kommtzeitkonrad On

PlistBuddy can do it with the help of base64. First decode your incoming Base64 stream into binary data.

base64 -D <<< AAAAAAAAAAAAAAACAAAAAA== > /tmp/tmp.bin

Then use PlistBuddy's Import command.

/usr/libexec/PlistBuddy -c "Import :Kernel:Emulate:Cpuid1Mask /tmp/tmp.bin" ~/Desktop/test.plist

Delete your binary data if not needed anymore.

rm /tmp/tmp.bin

PS: I am using this frequently to change data values in OpenCore.