macprefs¶
Command and library to export macOS preferences.
Installation¶
pip install macprefs
Usage¶
prefs-export is the main utility. You can export preferences, generate a
~/.macos-like script, and store the
results in a Git repository.
My primary usage is like so:
prefs-export --output-directory ~/.config/defaults --commit
See the commands documentation for more details.
About the generated shell script¶
A shell script named exec-defaults.sh will exist in the output directory. It may be executed,
but is primarily for copying defaults commands for use in your actual ~/.macos file.
Filtered domains and keys¶
Certain domains are filtered because they generally do not have anything useful to preserve, such
as com.apple.EmojiCache which only has a cache of Emoji usage data.
Some keys are filtered, as they contain values that often change and are non-useful, such as
session IDs and UI state (e.g. QtUi.MainWin(Geometry|State|Pos|Size)`,
`NSStatusItem Preferred Position).
Automated usage¶
A command macprefs-install-job is included which will install a daily launchd job. The job name
is sh.tat.macprefs.
Usage: macprefs-install-job [OPTIONS]
Job installer.
Options:
-K, --deploy-key FILE Key for pushing to Git repository.
-o, --output-directory DIRECTORY
Where to store the exported data.
--help Show this message and exit.
If the output directory has a .git directory, a commit will be automatically made. Be aware that
files will be added and removed automatically.
To stop this job permanently, run
launchctl unload -w ~/Library/LaunchAgents/sh.tat.macprefs.plist.
To uninstall this job, after stopping permanently, delete
~/Library/LaunchAgents/sh.tat.macprefs.plist.
Contents:
- Commands
- Configuration
- Library
- macprefs.config.read_config
- macprefs.constants.GLOBAL_DOMAIN_ARG
- macprefs.constants.MAX_CONCURRENT_EXPORT_TASKS
- macprefs.exceptions.ConfigTypeError
- macprefs.exceptions.PropertyListConversionError
- macprefs.plist2defaults.plist_to_defaults_commands
- macprefs.processing.make_key_filter
- macprefs.processing.remove_data_fields
- macprefs.processing.remove_data_fields_list
- macprefs.utils.defaults_export
- macprefs.utils.generate_domains
- macprefs.utils.git
- macprefs.utils.install_job
- macprefs.utils.is_git_installed
- macprefs.utils.prefs_export
- macprefs.utils.setup_output_directory
- Typing