Skip to main content

Prefsniff

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.

Installing

If you're here to simply use prefsniff and not to hack on it, there's no need to clone the git repo. You may simply install from PyPI via pip:

$ pip3 install prefsniff

Using

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
PREFSNIFF version 0.1.0b3
Watching directory: /Users/zach/Library/Preferences
Detected change: [deleted] /Users/zach/Library/Preferences/com.apple.dock.plist
Detected change: [created] /Users/zach/Library/Preferences/com.apple.dock.plist

File mode example:

$ prefsniff ~/Library/Preferences/com.apple.dock.plist
PREFSNIFF version 0.1.0b3
Watching prefs file: /Users/zach/Library/Preferences/com.apple.dock.plist
*****************************

defaults write com.apple.dock orientation -string right

*****************************

Additional Reading

Advanced defaults(1) Usage

An introduction to plist files and the defaults(1) command. Includes detailed explanation of each plist type and how to manipulate them with defaults.

Defaults Non-obvious Locations

An explanation of various defaults domains and where their corresponding plist files can be found on disk.

Autogenerating defaults(1) Commands

An introduction to this tool, prefsniff, and how to use it to autogenerate defaults commands.

TODO

  • 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

Metadata

Release files for prefsniff 0.3.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for prefsniff 0.3.1
File Size Uploaded
prefsniff-0.3.1.tar.gz 11.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for prefsniff 0.3.1
File Interpreter ABI Platform
prefsniff-0.3.1-py3-none-any.whl Python 3 none any Details

Total release size: 22.7 kB

Release files / prefsniff-0.3.1.tar.gz

Download URL prefsniff-0.3.1.tar.gz
Size 11.3 kB
Tags Source
SHA-256 checksum
How to use checksums
9a57e6cb13d766f68f64a86c845ba5612d4c1ede1b8146d481243b38afbbf77b
BLAKE2b-256 checksum
How to use checksums
1e34954ca37aec5f679d4753f59d9ba12b998eb0fe6824e1d3ae4feef0b272fc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.7

Release files / prefsniff-0.3.1-py3-none-any.whl

Download URL prefsniff-0.3.1-py3-none-any.whl
Size 11.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6ccdbd8bb7074dbd607993a1161d15d56c1f2313b6cdd047a90cb32b699fb277
BLAKE2b-256 checksum
How to use checksums
31527309b1aa6053cdfb094c5048ba0730e5e50e4151d14b5d859ff48c27918e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.7

Release history Release notifications | RSS feed

This release

0.3.1 This release

2 release files

0.3.0

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page