I have bash script which was written for OS X and now ported to Linux. I don't have access to the Linux box. The bash script would read values from plist files using the defaults read and PlistBuddy command available on OS X.

Since the Linux machine doesn't have these commands, I'm looking for workarounds. Is there library/script (Perl preferably) that helps user fetch values from plist files for a given key on a Linux machine?

I tried using sed/awk, but the output isn't reliable. I've come across scripts like plutil.pl that convert a plist file to other formats.

I have installed a Virtual machine running Ubuntu on my Mac so that I can test my changes before deploying to the actual Linux box.

  • Which programs on Linux do you expect to make use of plists? I haven't come across any in the last 12 years of Linux use on a daily basis.
    – tink
    Commented Oct 30, 2012 at 3:09
  • The linux machine hosts folders that have plist files in them. No programs on the Linux machine are going to use them.But I need to create a report on those folders and hence need to find a way to read values from the plist file on the Linux env.
    – smokinguns
    Commented Oct 30, 2012 at 3:19

3 Answers 3


libplist seems to meet your requirements. There is a Ubuntu package name "libplist-utils" that you could reference in your script:

Description-en: Apple property list converter This package containt tools to convert Apple property list files from binary to XML and vice-versa. It's part of the libimobiledevice stack, providing access to iDevices (iPod, iPhone, iPad ...).

Homepage: http://www.libimobiledevice.org/

Install command:

apt-get install libplist-utils

Usage example:

plistutil -i Info.plist

Since .plist files are already XML (or can be easily converted) you just need something to decode the XML.

For that use xml2:

$ cat com.apple.systemsound.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
$ xml2 < com.apple.systemsound.plist

You should be able to figure out the rest.

Or for Perl, use XML::Simple; (see perldoc for more) to put the XML data structure into a hash.


Python3 has a standard library for that:

plistlib can read and write .plist files, https://docs.python.org/3.9/library/plistlib.html

E.g. Get the value of MyKey from ./Info.plist:

$ python3 -c "import plistlib; print(plistlib.load(open('./Info.plist', 'rb'))['MyKey'])" 

This will work on any OS that runs python3.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .