For a new Mac, run this one-liner:
git clone https://github.com/TonyCTHsu/dotfiles.git ~/dotfiles && ~/dotfiles/install.shIf you prefer manual control:
# 1. Clone the repository
git clone https://github.com/TonyCTHsu/dotfiles.git ~/dotfiles
# 2. Install Homebrew (if needed)
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# 3. Install chezmoi
brew install chezmoi
# 4. Install dependencies
cd ~/dotfiles && brew bundle
# 5. Install dotfiles
# (--source only affects this one invocation and isn't persisted, so also
# write it to chezmoi.toml -- otherwise every later plain `chezmoi apply`
# falls back to the default source dir and fails)
mkdir -p ~/.config/chezmoi
cat > ~/.config/chezmoi/chezmoi.toml <<'EOF'
sourceDir = "$HOME/dotfiles"
EOF
chezmoi apply -v
# 6. Change shell to zsh (if needed)
chsh -s $(which zsh)SSH signing keys live on the machine, not in an agent you approve by hand.
Key files are encrypted in ~/.ssh. Passphrases sit in the login keychain.
The macOS ssh-agent loads the keys at every login. 1Password is only the
master copy things restore from. Nothing in the git path prompts you.
private_dot_ssh/run_once_import-from-1password.shruns on the firstchezmoi applyof a machine. It fetches the personal signing key from 1Password withop. It prompts once for a new passphrase, writes the encrypted key file, and stores the passphrase in the login keychain.run_onchange_load-personal-signing-key.shinstalls the LaunchAgent that loads~/.ssh/id_github_signinginto the agent at every login.dot_gitconfigmakes the personal identity the default for every repo.~/.gitconfig.work-routingand~/.ssh/config.localare untracked, machine-local, and exist only on work machines. See the next section.
If you ever delete ~/.ssh/id_github_signing on purpose, run_once_ will
not re-import it. Re-run the import by hand or reset chezmoi's state for it.
ssh -T git@github.com
git commit --allow-empty -m "Test signed commit"
git log --show-signature -1On a machine that also does DataDog work, two extra untracked files carry all the work-specific config. Copy them by hand:
~/.ssh/config.localincludes the git-config-tool ssh_config.~/.gitconfig.work-routingre-applies the work identity for repos with DataDog or ddoghq-family remotes. Without it, work repos silently commit as personal, and GitHub rejects the push with a key error.
If the pieces are missing, git config-tool doctor fails its include
check. The tool is the tripwire.
For machines set up before git-config-tool v4, run
git config-tool system-migrate, log out and back in, then run it once more
and finish with git config-tool setup.
Identity routing after that: personal by default, work identity by remote
URL (DataDog/**, ddoghq family).
After making changes to your dotfiles:
# Re-run dotfiles installation
chezmoi apply
# Install new packages (if Brewfile changed)
brew bundle
# Update vim plugins (if vimrc.bundles changed)
vim -u ~/.vimrc.bundles +PlugUpdate +PlugClean! +qaRestart the shell when errors appear after installation:
# Restart your shell
exec zsh
# Or restart your terminal completelyIf you get permission errors:
# Fix permissions on your home directory
sudo chown -R $(whoami):staff ~If Git signing does not work:
- Verify 1Password SSH agent is enabled
- Check that your public key is in
~/.ssh/allowed_signers - Verify the key is added to GitHub as a signing key
- Test with
ssh -T git@github.com