These are the scripts and configuration files that I use to set up a computer the way I like to do
The underlying framework here is provided by chezmoi, which allows me to manage multiple versions of the setup, by using templates.
Some highlights:
- custom window management functions, written for Hammerspoon
- command line auto-completion which first suggests previously successful commands (prioritizing those run in the current directory), before falling back to standard options ( zsh-autosuggestions, ZSH History Database, zsh-completions)
- a script that moves to the trash anything in the ~/Downloads
folder older than 30 days. Once a crontab one-liner, now a .plist
for
launchd
that I wrapped in an Applescript "app" just so it could have a custom icon in the preferences pane, which now seems to have the generic script icon anyway - a Brewfile composed of separate profiles for first-boot (no service dependencies), long-term (connected to password management and cloud storage), personal and work, used to install apps with homebrew-bundle and mas-cli
- Step through the initial macOS setup dialog, skipping everything that's optional
- Open the Terminal app and run
xcode-select --install
- Open Safari to https://brew.sh and download the
.pkg
asset for the latest release (i.e. 4.1.20) - System settings > Privacy & Security > Full Disk Access > Add
Utilities/Terminal (in order to be able to set macOS settings
later via the
defaults
command) curl https://raw.githubusercontent.com/pghk/dotfiles/develop/scripts/install.sh > setup.sh
and run it- Answer prompts from install script, choosing the profile
init
- Wait for software to be installed and macOS settings to be applied, then reboot
- Start Kitty, Karabiner, Hammerspoon
dot init
- answer prompts again, choosing the profile(personal|work)
- Sign in to iCloud etc
dot apply
to install more software- Start Alfred, Bartender, iStat menus
- Erase everything and start over
- Repeat 7 to 26 more times, performing experiments, taking notes and making small tweaks along the way until the process actually goes smoothly
- Plug in your backup drive and copy over everything you can't remember if it's important or not
defaults write com.apple.menuextra.clock IsAnalog -bool true
Common setup tasks can be performed by running these manually:
dump_macos_settings.sh
- writes the output ofdefaults read
to a file named from the current time. Run this before and after changing settings in the UI, then review the diff to discover how you might be able to codify the changeset_machine_name.sh
- setsHostName
,LocalHostName
, andComputerName
by calling scutilsetup_dock.sh
- arranges the items in the macOS dock by removing everything and then putting back the listed itemstest.bats
- asserts in CI that this tool works properly
- chezmoi - Manage your dotfiles across multiple diverse machines, securely.
- Awesome Dotfiles
- Homebrew / homebrew-cask - The Missing Package Manager for macOS
- mas-cli - Mac App Store command line interface
- Mackup - Keep your application settings in sync. I'm not actually using this right now, but it's a good resource for finding out where apps store their preferences
- Prezto - The configuration framework for Zsh
- ZSH History Database - A slightly better history for Zsh
- Hammerspoon - Staggeringly powerful macOS desktop automation with Lua