Automated setup
macOS#
Do you want your new machine (or a brand new, clean install of macOS on the same machine) to be automatically set up just the way you like it? You can set up your dotfiles, tools, apps (including the ones from the App Store), and macOS preferences automatically.
Tip
In Finder you can show/hide your hidden files e.g. dotfiles with Cmd+Shift+.
Current#
On your current machine
- Get the Homebrew package manager, the GitHub CLI and chezmoi to manage your dotfiles.
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" brew install gh brew install chezmoi
-
Back up you current configuration.
chezmoi init # Add your dotfiles e.g. chezmoi add ~/.gitconfig chezmoi add ~/.zshrc cd ~/.local/share/chezmoi brew bundle dump # generates your Brewfile # add and commit everything, then gh repo create dotfiles --public -d "My dotfiles" -y git remote add origin git@github.com:$GITHUB_USERNAME/dotfiles.git git branch -M main git push -u origin main
See my dotfiles repo for an example that includes:
- Brewfile with tools and apps from both Homebrew and the App Store (with mas).
- Dotfiles for git and shell configurations.
- iTerm profile.
- macOS preferences.
New#
On your new machine
-
Install Homebrew and chezmoi. Learn more.
Tip
Install antivirus software like Avast Security. The only reason I don't include it in my
Brewfile
is because at the time of this writing its Homebrew formula seems to be broken so I download it directly from their site. -
If you use Oh My Zsh, install it:
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
- Let chezmoi and Homebrew configure your new machine:
# Bring your dotfiles chezmoi init --apply $GITHUB_USERNAME # Install all tools, extensions, and apps from Homebrew and the App Store brew bundle --no-lock --file="~/.local/share/chezmoi/Brewfile" # You can update your dotfiles at any time with chezmoi update -v # You can run `brew bundle` again to apply changes to your Brewfile
- If you have a macOS configuration script, make sure your terminal has Full Disk Access and run it with
sudo
. -
If you have an iTerm profile
.json
file, add it as default and delete the old one. This will set your shell, font, colors, etc.- iTerm2 > Settings > Profiles > Other Actions... > Import JSON Profiles.
- Restart iTerm to reload the configuration file.
-
If you use GitHub with an SSH key:
cd ~/.local/share/chezmoi git remote -v # is it https? Change it to SSH with: git remote remove origin git remote add origin git@github.com:$GITHUB_USERNAME/dotfiles.git git fetch # retrieve upstream branches from the remote git branch -u origin/main # set 'main' to track 'origin/main'.