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/
Watching prefs file:
Detected change: [created] /Users/zach/Library/Preferences/com.apple.dock.plist.DnakVR2
Detected change: [modified] /Users/zach/Library/Preferences/
Detected change: [deleted] /Users/zach/Library/Preferences/com.apple.dock.plist
Detected change: [modified] /Users/zach/Library/Preferences/com.apple.dock.plist.DnakVR2
Detected change: [moved] /Users/zach/Library/Preferences/com.apple.dock.plist.DnakVR2
Detected change: [modified] /Users/zach/Library/Preferences/

File mode example:

$ ./prefsniff ~/Library/Preferences/com.apple.dock.plist
Watching prefs file: com.apple.dock.plist
*****************************

defaults write com.apple.dock orientation -string left

*****************************
Watching prefs file: com.apple.dock.plist

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.1.0b1.tar.gz (7.5 kB view details)

Uploaded Source

Built Distribution

prefsniff-0.1.0b1-py2-none-any.whl (9.5 kB view details)

Uploaded Python 2

File details

Details for the file prefsniff-0.1.0b1.tar.gz.

File metadata

  • Download URL: prefsniff-0.1.0b1.tar.gz
  • Upload date:
  • Size: 7.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/3.7.4

File hashes

Hashes for prefsniff-0.1.0b1.tar.gz
Algorithm Hash digest
SHA256 8dc3e4ff38d68c18e865f372b8f7ab2b02cefc5ae0c45334a1e6862f30ae096b
MD5 a24b05d23c2def702f9e7929f6bc951b
BLAKE2b-256 e1d472e549be8593aac39555e076927d782b3fa786203a25e6ce10375dbbaa55

See more details on using hashes here.

File details

Details for the file prefsniff-0.1.0b1-py2-none-any.whl.

File metadata

  • Download URL: prefsniff-0.1.0b1-py2-none-any.whl
  • Upload date:
  • Size: 9.5 kB
  • Tags: Python 2
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/3.7.4

File hashes

Hashes for prefsniff-0.1.0b1-py2-none-any.whl
Algorithm Hash digest
SHA256 40c7a6ec074835f2cd92518fbc435259f97ce1c80a2bf14e43275ff369a5270c
MD5 d5e27e76e9329853bcdbbd4bed1c6097
BLAKE2b-256 114c531a778a7d567f0263777b991fd6548450b17cd5aaa5089d222106cdbc4f

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