What Is a PLIST File?

Estimated read time 4 min read

[ad_1]

If you’ve used a Mac or developed apps for iPhones or iPads, you’ve probably run across a PLIST file at some point. But what is it, and what does “PLIST” mean, anyway? We’ll explain.

It’s a Property List File

A PLIST file is a special text file that contains data in the Property List format. The file is used by macOS, iOS, and iPadOS applications to store settings and other data in a key-value format with an XML structure. For example, every iPhone app includes at least one PLIST file called Info.plist that contains basic configuration information for the app.

Ordinary users who download an iPhone app never see or have to directly interact with this file, but developers must create one to make their app work. PLIST files can be created and edited with a text editor, such as TextEdit. They are typically stored in the ~/Library/Preferences/ folder on a Mac, but also can be stored anywhere on the filesystem.

The PLIST Format

The Property List format contains a series of key-value pairs encoded in XML. The keys are always strings, and the values can be strings, numbers, arrays, dictionaries, or dates. When you open a PLIST file in a text editor, it looks like a jumble of data. However, the data is actually organized into a format that is easy for computers to read.

Here is a simple example of a PLIST file:

<?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″>
<dict>
<key>Name</key>
<string>Newt Masterson</string>
<key>Age</key>
<integer>43</integer>
<key>Children</key>
<array>
<string>Ellen</string>
<string>Luna</string>
<string>Norma</string>
</array>
</dict>
</plist>

In this example, the file contains three key-value pairs. The first pair has a key of “Name” and a value of “Newt Masterson”. The second pair has a key of “Age” and a value of 43 (an integer). The third pair has a key of “Children” and a value of an array of strings. Arrays and dictionaries can contain other key-value pairs and arrays. This allows you to store data in a hierarchical format.

How to Edit PLIST Files

On a Mac, PLIST files are often used to store application preferences in the ~/Library/Preferences/ folder or within an application’s package, but sometimes in other locations as well. For example, the com.apple.TextEdit.plist file contains the preferences for the TextEdit application (located in ~/Library/Containers/com.apple.TextEdit/Data/Library/Preferences/ ).

When you open the TextEdit application, it reads the com.apple.TextEdit.plist file and loads the preferences. If you make any changes to the preferences within the app—such as changing the font size—those changes are saved back to the PLIST file.

A programmer programming a bug.
Africa Studio / Shutterstock

Warning: It’s dangerous to manually edit PLIST files unless you know exactly what you’re doing. If you make a mistake, it could cause the app to crash and no longer work properly. Before you make any changes, make a backup copy of the original PLIST file that you can revert to in case something goes wrong.

You can also edit an application’s PLIST file manually, but it can be very tricky depending on how a particular application writes data to a PLIST file. A knowledge of XML structure helps. For example, if you want to change the font size for the TextEdit application, you would open the com.apple.TextEdit.plist file in a text editor or Xcode and find the key related to font size, change the value, save the PLIST file, then exit the editing application.

Sometimes the keys aren’t listed, and in those cases it is likely best to just leave the PLIST file alone unless you have deep technical knowledge about how the application works. Instead, change the preferences within the app itself. Good luck!

RELATED: What Is An XML File (And How Do I Open One)?



[ad_2]

Source link

You May Also Like

More From Author