Skip to main content

macOS defaults(1) command generator

Reason this release was yanked:

forgot to merge fixes

Project description

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

Project details


Download files

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

Source Distribution

prefsniff-0.3.0.tar.gz (11.2 kB view details)

Uploaded Source

Built Distribution

prefsniff-0.3.0-py3-none-any.whl (11.3 kB view details)

Uploaded Python 3

File details

Details for the file prefsniff-0.3.0.tar.gz.

File metadata

  • Download URL: prefsniff-0.3.0.tar.gz
  • Upload date:
  • Size: 11.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.7

File hashes

Hashes for prefsniff-0.3.0.tar.gz
Algorithm Hash digest
SHA256 356c5d87353e6fbd5d101549557238fe74b1e6d457df74622b9bec2ffa7659d6
MD5 03d386b1ce7e89404d17221eb9f2b96c
BLAKE2b-256 50d89ec9db959a018813bd2c9e08d4409a4950e97f558750063df724b4322692

See more details on using hashes here.

File details

Details for the file prefsniff-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: prefsniff-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 11.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.7

File hashes

Hashes for prefsniff-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f1f9721df70672a2bde16483e15b4badbd36b8f823bcb9e6843d8136cba38822
MD5 1345f7fcedeb4967636b10ccff1c7270
BLAKE2b-256 dd2bf84b2c8e55a2f88b2e92e1939f7916c3ef6c49daf272c2cd07758c6cc210

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page