
Advanced Plex Configuration on macOS
Advanced Plex Configuration on macOS
Take your Plex server to the next level with advanced configurations and automation on macOS.
Homebrew-Based Management
Install Plex via Homebrew
# Install Plex Media Server
brew install --cask plex-media-server
# Install PlexConnect tools
brew install plex-media-playerUpdate Management
# Update Plex
brew upgrade --cask plex-media-server
# Check for updates
brew outdated --caskLaunch Agent Configuration
Auto-Start Plex
Create a Launch Agent for automatic startup:
nano ~/Library/LaunchAgents/com.plexapp.plexmediaserver.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>Label</key>
<string>com.plexapp.plexmediaserver</string>
<key>ProgramArguments</key>
<array>
<string>/Applications/Plex Media Server.app/Contents/MacOS/Plex Media Server</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>KeepAlive</key>
<true/>
<key>StandardOutPath</key>
<string>/tmp/plex-stdout.log</string>
<key>StandardErrorPath</key>
<string>/tmp/plex-stderr.log</string>
</dict>
</plist>Load the agent:
launchctl load ~/Library/LaunchAgents/com.plexapp.plexmediaserver.plistAdvanced Transcoding
Intel Quick Sync (Intel Macs)
For Intel Macs with integrated graphics:
- Settings → Transcoder
- Enable “Use hardware acceleration when available”
- Intel Quick Sync is automatically detected
Apple Silicon Optimization
For M1/M2/M3 Macs:
- Hardware transcoding uses VideoToolbox
- Enable in Settings → Transcoder
- Supports H.264 and HEVC encoding
Transcoder Settings
# Find transcoder binary
ls "/Applications/Plex Media Server.app/Contents/MacOS/"
# Check VideoToolbox support
system_profiler SPDisplaysDataType | grep -i "Metal"Database Management
Database Location
# Navigate to database
cd ~/Library/Application\ Support/Plex\ Media\ Server/Plug-in\ Support/Databases/
# List database files
ls -la *.dbBackup Database
#!/bin/bash
# plex-backup.sh
PLEX_DB="$HOME/Library/Application Support/Plex Media Server/Plug-in Support/Databases"
BACKUP_DIR="$HOME/PlexBackups"
DATE=$(date +%Y%m%d)
mkdir -p "$BACKUP_DIR"
# Stop Plex for clean backup
osascript -e 'quit app "Plex Media Server"'
sleep 5
# Backup database
cp "$PLEX_DB/com.plexapp.plugins.library.db" "$BACKUP_DIR/library-$DATE.db"
# Restart Plex
open -a "Plex Media Server"
echo "Backup completed: $BACKUP_DIR/library-$DATE.db"Database Optimization
# Optimize database (Plex must be stopped)
sqlite3 "$HOME/Library/Application Support/Plex Media Server/Plug-in Support/Databases/com.plexapp.plugins.library.db" "VACUUM;"
sqlite3 "$HOME/Library/Application Support/Plex Media Server/Plug-in Support/Databases/com.plexapp.plugins.library.db" "REINDEX;"Automation Scripts
Library Scan Automation
#!/bin/bash
# scan-library.sh
PLEX_TOKEN="your-plex-token"
PLEX_URL="http://localhost:32400"
LIBRARY_ID="1" # Get from /library/sections
curl -X GET "$PLEX_URL/library/sections/$LIBRARY_ID/refresh?X-Plex-Token=$PLEX_TOKEN"Get Your Plex Token
# Method 1: From Plex Web
# Sign in → Open browser console → Copy X-Plex-Token from any API request
# Method 2: XML method
curl -u "username:password" "https://plex.tv/users/sign_in.xml" \
-X POST -H "X-Plex-Client-Identifier: macOS-script"Scheduled Maintenance
Create a cron job for regular maintenance:
crontab -eAdd:
# Daily library scan at 3 AM
0 3 * * * /path/to/scan-library.sh
# Weekly database backup at 4 AM Sunday
0 4 * * 0 /path/to/plex-backup.sh
# Monthly database optimization at 5 AM, 1st of month
0 5 1 * * /path/to/optimize-db.shTautulli Integration
Install Tautulli
# Clone repository
git clone https://github.com/Tautulli/Tautulli.git ~/Tautulli
# Install dependencies
cd ~/Tautulli
pip3 install -r requirements.txt
# Run Tautulli
python3 Tautulli.pyCreate Launch Agent
<?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>Label</key>
<string>com.tautulli</string>
<key>ProgramArguments</key>
<array>
<string>/usr/local/bin/python3</string>
<string>/Users/YOURUSERNAME/Tautulli/Tautulli.py</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>WorkingDirectory</key>
<string>/Users/YOURUSERNAME/Tautulli</string>
</dict>
</plist>Kometa (PMM) Configuration
Install Kometa
# Create directory
mkdir -p ~/Kometa && cd ~/Kometa
# Clone repository
git clone https://github.com/Kometa-Team/Kometa.git .
# Create virtual environment
python3 -m venv venv
source venv/bin/activate
# Install dependencies
pip install -r requirements.txtBasic Configuration
Create config/config.yml:
libraries:
Movies:
collection_files:
- pmm: imdb
- pmm: trakt
overlay_files:
- pmm: resolution
- pmm: audio_codec
TV Shows:
collection_files:
- pmm: imdb
- pmm: trakt
plex:
url: http://localhost:32400
token: YOUR_PLEX_TOKEN
tmdb:
apikey: YOUR_TMDB_API_KEY
radarr:
url: http://localhost:7878
token: YOUR_RADARR_API_KEY
root_folder_path: /Movies
quality_profile: HD-1080p
sonarr:
url: http://localhost:8989
token: YOUR_SONARR_API_KEY
root_folder_path: /TV Shows
quality_profile: HD-1080pSchedule Kometa
# Run Kometa daily at 5 AM
0 5 * * * cd ~/Kometa && source venv/bin/activate && python kometa.py --runNetwork Storage Integration
Mount NAS on Boot
Create a script to mount network shares:
#!/bin/bash
# mount-nas.sh
# Mount SMB share
mount_smbfs //username:password@nas.local/media /Volumes/Media
# Or use AFP
mount_afp afp://username:password@nas.local/media /Volumes/MediaAuto-Mount with Launch Agent
<?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>Label</key>
<string>com.nas.mount</string>
<key>ProgramArguments</key>
<array>
<string>/path/to/mount-nas.sh</string>
</array>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>Monitoring and Logging
Custom Log Analysis
# View Plex logs
tail -f "$HOME/Library/Logs/Plex Media Server/Plex Media Server.log"
# Search for errors
grep -i "error\|warning" "$HOME/Library/Logs/Plex Media Server/"*.log
# Analyze transcoding
grep "transcoding" "$HOME/Library/Logs/Plex Media Server/Plex Transcoder Statistics.log"System Monitoring
# Monitor Plex resource usage
top -pid $(pgrep "Plex Media Server")
# Check memory usage
ps aux | grep -i plex
# Network connections
lsof -i -P | grep -i plexAPI Integration
Plex API Examples
# Get all libraries
curl -s "http://localhost:32400/library/sections?X-Plex-Token=TOKEN"
# Get library contents
curl -s "http://localhost:32400/library/sections/1/all?X-Plex-Token=TOKEN"
# Search library
curl -s "http://localhost:32400/search?query=inception&X-Plex-Token=TOKEN"
# Get server info
curl -s "http://localhost:32400/identity?X-Plex-Token=TOKEN"Python Automation
#!/usr/bin/env python3
# plex-manager.py
from plexapi.server import PlexServer
import os
PLEX_URL = 'http://localhost:32400'
PLEX_TOKEN = os.environ.get('PLEX_TOKEN')
plex = PlexServer(PLEX_URL, PLEX_TOKEN)
# List all libraries
for section in plex.library.sections():
print(f"{section.title}: {section.totalSize} items")
# Refresh specific library
movies = plex.library.section('Movies')
movies.refresh()
# Search and play
results = plex.search('Inception')
print(results)Install the library:
pip3 install plexapiSecurity Hardening
Network Restrictions
Limit access to specific IP ranges:
- Settings → Network
- Add to “LAN Networks”:
192.168.1.0/24
Regular Security Checks
#!/bin/bash
# security-check.sh
echo "=== Plex Security Audit ==="
# Check open ports
echo "Open ports:"
sudo lsof -i -P | grep LISTEN | grep -i plex
# Check recent access
echo "Recent connections:"
tail -20 "$HOME/Library/Logs/Plex Media Server/Plex Media Server.log" | grep -i "auth\|session"
# Check for updates
echo "Current version:"
defaults read "/Applications/Plex Media Server.app/Contents/Info.plist" CFBundleShortVersionStringPerformance Tuning
Memory Settings
For large libraries, adjust memory settings:
# Increase file descriptor limit
sudo launchctl limit maxfiles 65536 200000
# Add to ~/.zshrc
ulimit -n 65536SSD Optimization
If using SSD for transcoding:
# Create RAM disk for transcoding (8GB example)
diskutil erasevolume HFS+ "RAMDisk" `hdiutil attach -nomount ram://16777216`
# Point Plex transcoder to RAM disk
# Settings → Transcoder → Transcoder temporary directory: /Volumes/RAMDiskCongratulations! 🎉
You’ve mastered advanced Plex configuration on macOS! Your server is now:
- ✅ Automated with scripts and schedules
- ✅ Backed up and optimized
- ✅ Integrated with monitoring tools
- ✅ Secured and hardened
- ✅ Performance tuned
You’re now a Plex power user on macOS!