What Is a .PLIST File?
Apple property list
Apple Property List Format
Overview
Apple Property List (appleplist) is a structured data format used throughout Apple's operating systems (macOS, iOS, watchOS, tvOS) to store configuration data, preferences, and serialized objects. Property lists provide a platform-native way to store key-value pairs, arrays, and nested structures in both XML and binary formats.
Technical Details
File Extension: .plist
MIME Type: application/x-plist
Format Types: XML, Binary, JSON (recent)
Character Encoding: UTF-8 (XML), UTF-16 (Binary)
Root Element: Single container object
Platform: Apple ecosystems
Property lists support these data types:
- Strings, Numbers, Booleans, Dates
- Data (binary blobs)
- Arrays (ordered collections)
- Dictionaries (key-value pairs)
Key Features
- Native Integration: Deep OS and framework integration
- Type Safety: Strongly typed data structures
- Multiple Formats: XML, binary, and JSON variants
- Serialization: Automatic object graph serialization
- Unicode Support: Full internationalization support
- Validation: Built-in syntax and type checking
XML Format Structure
<?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>ApplicationName</key>
<string>My Application</string>
<key>Version</key>
<real>2.1</real>
<key>Enabled</key>
<true/>
<key>LastModified</key>
<date>2024-01-15T10:30:00Z</date>
<key>Configuration</key>
<dict>
<key>ServerURL</key>
<string>https://api.example.com</string>
<key>Timeout</key>
<integer>30</integer>
</dict>
<key>SupportedFormats</key>
<array>
<string>JSON</string>
<string>XML</string>
<string>Binary</string>
</array>
<key>IconData</key>
<data>iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8/5+hHgAHggJ/PchI7wAAAABJRU5ErkJggg==</data>
</dict>
</plist>
Data Types
Primitive Types
<!-- String -->
<key>Name</key>
<string>John Doe</string>
<!-- Integer -->
<key>Age</key>
<integer>30</integer>
<!-- Real Number -->
<key>Price</key>
<real>19.99</real>
<!-- Boolean -->
<key>IsActive</key>
<true/>
<key>IsHidden</key>
<false/>
<!-- Date (ISO 8601) -->
<key>CreatedAt</key>
<date>2024-01-15T10:30:00Z</date>
<!-- Binary Data (Base64) -->
<key>ImageData</key>
<data>R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==</data>
Collection Types
<!-- Array -->
<key>Items</key>
<array>
<string>Item 1</string>
<string>Item 2</string>
<integer>42</integer>
</array>
<!-- Dictionary -->
<key>UserInfo</key>
<dict>
<key>FirstName</key>
<string>John</string>
<key>LastName</key>
<string>Doe</string>
<key>Settings</key>
<dict>
<key>Theme</key>
<string>Dark</string>
</dict>
</dict>
Common Use Cases
- Application Preferences: User and system settings
- Configuration Files: Application and service configuration
- Info.plist Files: Bundle metadata and capabilities
- Localization: String resources and localized content
- Cache Files: Temporary data and state preservation
- Build Configuration: Xcode project and build settings
Command Line Tools
Basic Operations
# Read plist file
defaults read com.apple.dock
# Read specific key
defaults read com.apple.dock orientation
# Write plist value
defaults write com.example.app PreferenceName -string "Value"
# Delete plist key
defaults delete com.example.app PreferenceName
# List all domains
defaults domains
Format Conversion
# Convert binary to XML
plutil -convert xml1 file.plist
# Convert XML to binary
plutil -convert binary1 file.plist
# Convert to JSON (macOS 10.13+)
plutil -convert json file.plist
# Pretty print plist
plutil -p file.plist
Validation and Repair
# Check plist syntax
plutil -lint file.plist
# Extract and validate
plutil file.plist
# file.plist: OK
# Repair corrupted plist
plutil -convert xml1 broken.plist
Programming APIs
Objective-C
// Reading plist
NSURL *url = [NSURL fileURLWithPath:@"config.plist"];
NSDictionary *plist = [NSDictionary dictionaryWithContentsOfURL:url];
// Writing plist
NSDictionary *data = @{
@"Version": @"1.0",
@"Settings": @{
@"Theme": @"Dark",
@"Language": @"en"
}
};
[data writeToURL:url atomically:YES];
// Using NSPropertyListSerialization
NSData *xmlData = [NSPropertyListSerialization
dataWithPropertyList:data
format:NSPropertyListXMLFormat_v1_0
options:0
error:&error];
Swift
// Reading plist
if let path = Bundle.main.path(forResource: "Config", ofType: "plist"),
let data = NSDictionary(contentsOfFile: path) {
print(data)
}
// Modern Swift approach
struct Configuration: Codable {
let version: String
let settings: Settings
struct Settings: Codable {
let theme: String
let language: String
}
}
// Load with PropertyListDecoder
let url = URL(fileURLWithPath: "config.plist")
let data = try Data(contentsOf: url)
let config = try PropertyListDecoder().decode(Configuration.self, from: data)
// Save with PropertyListEncoder
let encoder = PropertyListEncoder()
encoder.outputFormat = .xml
let encodedData = try encoder.encode(config)
try encodedData.write(to: url)
Python
import plistlib
# Reading plist
with open('config.plist', 'rb') as f:
plist_data = plistlib.load(f)
# Writing plist (XML format)
data = {
'ApplicationName': 'My App',
'Version': 1.0,
'Settings': {
'Theme': 'Dark',
'Language': 'en'
},
'Features': ['Feature1', 'Feature2']
}
with open('output.plist', 'wb') as f:
plistlib.dump(data, f, fmt=plistlib.FMT_XML)
Application Bundle Usage
Info.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">
<dict>
<key>CFBundleDisplayName</key>
<string>My Application</string>
<key>CFBundleIdentifier</key>
<string>com.company.myapp</string>
<key>CFBundleVersion</key>
<string>1.0.0</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>LSMinimumSystemVersion</key>
<string>10.15</string>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<false/>
</dict>
</dict>
</plist>
Entitlements.plist
<dict>
<key>com.apple.security.app-sandbox</key>
<true/>
<key>com.apple.security.files.user-selected.read-write</key>
<true/>
<key>com.apple.security.network.client</key>
<true/>
</dict>
Best Practices
Structure and Organization
<!-- Good: Logical grouping -->
<dict>
<key>UserInterface</key>
<dict>
<key>Theme</key>
<string>Dark</string>
<key>Language</key>
<string>en</string>
</dict>
<key>Network</key>
<dict>
<key>BaseURL</key>
<string>https://api.example.com</string>
<key>Timeout</key>
<integer>30</integer>
</dict>
</dict>
Performance Considerations
// Prefer binary format for frequently accessed files
NSPropertyListFormat format = NSPropertyListBinaryFormat_v1_0;
// Use lazy loading for large plists
@property (nonatomic, strong, readonly) NSDictionary *configuration;
- (NSDictionary *)configuration {
if (!_configuration) {
_configuration = [NSDictionary dictionaryWithContentsOfFile:self.configPath];
}
return _configuration;
}
Error Handling
do {
let data = try Data(contentsOf: plistURL)
let plist = try PropertyListSerialization.propertyList(
from: data,
options: [],
format: nil
)
} catch let error as NSError {
if error.domain == NSCocoaErrorDomain {
switch error.code {
case NSFileReadNoSuchFileError:
print("Plist file not found")
case NSPropertyListReadCorruptError:
print("Plist file is corrupted")
default:
print("Error reading plist: \(error.localizedDescription)")
}
}
}
Security Considerations
Data Validation
// Always validate plist data
id plistObject = [NSDictionary dictionaryWithContentsOfFile:path];
if ([plistObject isKindOfClass:[NSDictionary class]]) {
NSDictionary *config = (NSDictionary *)plistObject;
NSString *version = config[@"Version"];
if ([version isKindOfClass:[NSString class]]) {
// Safe to use
}
}
Sensitive Data
// Don't store sensitive data in plists
// Use Keychain Services instead
SecItemAdd((__bridge CFDictionaryRef)@{
(__bridge NSString *)kSecClass: (__bridge NSString *)kSecClassGenericPassword,
(__bridge NSString *)kSecAttrAccount: @"username",
(__bridge NSString *)kSecValueData: [@"password" dataUsingEncoding:NSUTF8StringEncoding]
}, NULL);
Property lists remain fundamental to Apple platform development, providing a robust, type-safe, and platform-integrated solution for data persistence and configuration management across all Apple operating systems.
File Information
Apple property list
Data
.plist
application/x-plist
Related File Types
Other file types in the Data category you might also need:
Start Analyzing APPLEPLIST Files Now
Use our free AI-powered tool to detect and analyze Apple property list files instantly with Google's Magika technology.
⚡Try File Detection Tool