I need my script to get information from macOS. The information is located in a plist file in ~/Library/Preferences/com.apple.SystemProfiler.plist.

The binary content follows.

bplist00�_NSWindow Frame SystemProfileYCPU Names_344 284 751 520 0 0 1440 877 �]HV2J-en-GB_GB_4MacBook Pro (13-inch, 2017, Two Thunderbolt 3 ports) ,6VYg

I would like just to put in a text file what is in bold and italic here, between the parenthesis. I tried different methods found on Internet without luck.


A plist file format is one of binary XML, plain text XML, or even plain text JSON. The plist file that was posted in the question is the binary XML format.

One way to produce plain text from the binary file is as follows.

plutil -convert xml1 com.apple.SystemProfiler.plist

To convert the file back to binary, use plutil as follows.

plutil -convert binary1 com.apple.SystemProfiler.plist

This would have helped to produce a better, plain text format for the question.

Assuming that "HV2J-en-GB_GB_4" is the right key, then the desired value might be acquired by using PlistBuddy as follows. Note that wherever whitespace is encountered, single quotes can encapsulate text.

/usr/libexec/PlistBuddy -c "print :'CPU Names':HV2J-en-GB_GB_4" com.apple.SystemProfiler.plist

For the BASH script, one might put this value in a variable using command substitution.

model=$(/usr/libexec/PlistBuddy -c "print :'CPU Names':HV2J-en-GB_GB_4" com.apple.SystemProfiler.plist)

Afterward, the value is available in the variable, $model.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.