Skip to main content

macOS defaults(1) command generator

Project description


Author: Zachary Cutlip, uid000 at gmail

prefsniff is a utility to watch macOS plist files for changes, and then autogenerate the defaults command to apply those changes. Its intended use is to have prefsniff watch a plist file while setting a system or application preference. The resulting defaults command can then be added to a shell script or incorporated into a configuration management system such as Ansible.


$ git clone <repo url> prefsniff
$ cd prefsniff
$ pip install -r ./requirements.txt


prefsniff has two modes of operation; directory mode and file mode.

  • Directory mode: watch a directory (non-recursively) for plist files that are unlinked and replaced in order to observe what file backs a particular configuration setting.
  • File mode: watch a plist file in order to represent its changes as one or more defaults command.

Directory mode example:

$ ./prefsniff ~/Library/Preferences/
Watching prefs file:
Detected change: [created] /Users/zach/Library/Preferences/
Detected change: [modified] /Users/zach/Library/Preferences/
Detected change: [deleted] /Users/zach/Library/Preferences/
Detected change: [modified] /Users/zach/Library/Preferences/
Detected change: [moved] /Users/zach/Library/Preferences/
Detected change: [modified] /Users/zach/Library/Preferences/

File mode example:

$ ./prefsniff ~/Library/Preferences/
Watching prefs file:

defaults write orientation -string left

Watching prefs file:


  • Implement data and date plist types
  • Clean up output so that it can be redirected to a shell script or similar
  • Add additional output options (such as the name of a shell script to create)
  • Split utility & API
    • Make prefsniff into a python module that exports API
    • Make a separate prefsniff command-line utility that uses the API

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for prefsniff, version 0.1.0b2
Filename, size File type Python version Upload date Hashes
Filename, size prefsniff-0.1.0b2-py2-none-any.whl (9.6 kB) File type Wheel Python version py2 Upload date Hashes View
Filename, size prefsniff-0.1.0b2.tar.gz (7.5 kB) File type Source Python version None Upload date Hashes View

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page