5 ms·
It's now a habit to save all my changes in system and app preferences in a script. First I do a defaults read > 1 Then I change the setting in the app or
by bartvk 3y ago
It's now a habit to save all my changes in system and app preferences in a script.
First I do a
defaults read > 1
Then I change the setting in the app or System Settings, then back on the commandline, I do
defaults read > 2
diff 1 2
The change gets copied to a preferences.sh file with a whole bunch of statements like:
defaults write com.apple.ical "Show Week Numbers" -bool true
Afterwards, I don't care where the setting is. I just set it in my preferences.sh file, and if I update any of it, I run that file.
- e40 3y agoThis is brilliant and I’m mad that I didn’t think of it.
- Cockbrand 3y agoIt is indeed brilliant, and I’m glad I learned this today!
- elcapitan 3y agoThis is great! Is there some non-lethal way to retrieve the initial system settings to diff from?
- pxc 3y agoDon't the non-global defaults generally live in per-user directories like ~/Library/Preferences or whatever? You can likely get a lot of this by just creating a new user.
- detourdog 3y agoThere is also user.template that lives in a directory. This file acts like a skel file and holds all the standard settings for new users created on that machine. This can be used to customize settings and folders. https://derflounder.wordpress.com/ https://derflounder.wordpress.com/
- snapplebobapple 3y agoI wonder if the program i use to manage my dotfiles could help manage your scripts and extend your setup to all your desktops? Its called yadm (https://yadm.io/ https://yadm.io/) it makes it so easy to have a laptop and a desktop or two. Edit: seems to support doing a diff and reverting/modifying right in yadm, i just do t really use thst bit myself: https://yadm.io/docs/common_commands# https://yadm.io/docs/common_commands#
- pxc 3y agoBeware that some settings won't show up this way, and some settings that you can witness through `defaults read <some plist file>` cannot be safely edited through `defaults write`. Power management settings, for example, will break some System Settings panes when manually written, in addition to not effectively modifying the relevant setting. Those, you have to modify with the `pmset` command instead.
- globular-toast 3y agoSeems more difficult than my Linux setup.
- bolangi 3y agoThat's what all those engineering dollars buy you!
- microtonal 3y agoAt least virtually all applications use the same configuration mechanism, which is a lot nicer than many custom formats scattered everywhere (though more and more applications seem to use .config on Linux now).
- manderley 3y agoVirtually all applications for Mac OS storing their configuration in plist files is very hard to believe.
- globular-toast 3y agoTrue. I use GNU stow to symlink config files from my centralised "dotfile" repo which is version controlled and distributed via git which overcomes the scattered aspect. Different formats don't annoy me too much because some programs have a legitimate reason for using particular configuration formats and it's better than trying to shoehorn domain specific languages into YAML, for example. It would be nice to have the whole system configured in a language like Lisp or Python, though.
- martinflack 3y agoI actually prefer programs to have their own configuration files with well-intentioned format choices. Where Linux has adopted these registry-style configurations accessible only through GUI or arcane CLI commands nobody is supposed to actually utilize, it becomes far less accessible and goes against the *nix spirit, IMHO.
- joshspankit 3y agoI’d appreciate seeing those statements added to the linked article. Thank you for sharing it! I hope the author sees your comment and uses this technique to add them.
- ParetoOptimal 3y ago> It's now a habit to save all my changes in system and app preferences in a script. The end game of this type if thing is NixOS where your OS is created from a declarative and reproducible Nix file as are all of it's programs as well as their dependencies.
- pxc 3y agoNix-Darwin and/or Home Manager on macOS can provide a nice, slow way to transition into the Nix world as well, for folks who are hesitant to jump in with NixOS and like to have other options around. There's even a very nice Homebrew module for Nix-Darwin to let you manage Homebrew from Nix if you want to Nixify without giving up Homebrew! It doesn't feel nearly as 'safe' as NixOS, in that OS upgrades are less predictable and can break a lot of things (not limited to Nix). But all-in-all, it's really not bad, and for some use cases it might be better.
- aeadio 3y agoI do something similar, but instead of a script with a bunch of `defaults write`, Ansible has an osx_defaults module. https://docs.ansible.com/ansible/latest/collections/community/general/osx_defaults_module.html https://docs.ansible.com/ansible/latest/collections/communit...
- pxc 3y agonix-darwin also handles this fairly nicely. The built-in options are listed in the modules docs starting here: https://daiderd.com/nix-darwin/manual/index.html#opt-system.defaults._.GlobalPreferences_._com.apple.mouse.scaling_ https://daiderd.com/nix-darwin/manual/index.html#opt-system.... but you can also define custom ones without writing new modules via CustomPreferences and CustomSystemPreferences: https://daiderd.com/nix-darwin/manual/index.html#opt-system.defaults.CustomSystemPreferences https://daiderd.com/nix-darwin/manual/index.html#opt-system.... I track all of my `defaults` settings (aside from power management) in version control this way on my work machine. :)