Skip to main content

macOS defaults(1) command generator

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

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

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

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

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.2.0.tar.gz (9.6 kB view details)

Uploaded Source

Built Distribution

prefsniff-0.2.0-py3-none-any.whl (11.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: prefsniff-0.2.0.tar.gz
  • Upload date:
  • Size: 9.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/51.0.0 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.9.1

File hashes

Hashes for prefsniff-0.2.0.tar.gz
Algorithm Hash digest
SHA256 b3a14079459d73d32db552a9235471f6666263c33790b2933562ce3f685ed4e9
MD5 85670511299581d5a1e80f98bc20adad
BLAKE2b-256 084dd4d5c3f72807e4333b10e1750fd9fae452a25059ed19df0b168e02264bd0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: prefsniff-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 11.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/51.0.0 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.9.1

File hashes

Hashes for prefsniff-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2ede3c77f54d3da0ce51ed86902abaadb3517a42ea4c14f66bf442b6c7581483
MD5 245edb29b037252f667bb064bae42f0b
BLAKE2b-256 df4ce9bd16973238cc8508e08e4d89363599ddc5136839a38157cb6b1095eb1e

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