My personal macOS dotfiles: the Homebrew Bash shell setup, aliases, functions,
a thorough Git configuration, a Brewfile of every tool and app I install, and
a .macos script that reproduces my system preferences. Built for Apple Silicon
Macs.
The repo is meant to live in your $HOME directory. It only tracks the files it
already knows about and ignores everything else.
A brand-new Mac has no SSH key yet, so clone over HTTPS first:
cd "$HOME"
git init
git remote add origin https://github.com/hkdobrev/dotfiles.git
git fetch origin main
git reset --hard origin/mainIt is recommended to fork the repo and adjust it to your own taste.
init/install.sh is the single entry point for a new machine. It:
- installs the Xcode Command Line Tools and Homebrew,
- runs
brew bundleover theBrewfile— every formula, Cask app and Mac App Store app (sign in to the App Store first so themasapps install), - switches the login shell to the Homebrew Bash, and
- applies the macOS system preferences via
.macos(Dock, Finder, trackpad, Mission Control, Stage Manager, menu bar and keyboard shortcuts).
./init/install.shIt is idempotent — safe to re-run. The final .macos step asks for confirmation
(it restarts Dock/Finder and quits a few apps). To run unattended and skip it:
NO_MACOS=1 ./init/install.shYou can also re-apply individual pieces at any time:
./.macos # just the macOS system preferences
brew bundle --file=~/Brewfile # just the Homebrew packagesSome macOS changes need a logout/restart to take effect.
Once you have an SSH key, authenticate with GitHub and move the remote off HTTPS.
The bundled ~/.ssh/config uses the default ~/.ssh/id_ed25519 key name:
# Create a modern key (no passphrase) if you don't have one:
ssh-keygen -t ed25519 -C "you@example.com"
# Authenticate the GitHub CLI (installed via the Brewfile), wire it into Git,
# and register the public key on your account:
gh auth login
gh auth setup-git
gh ssh-key add ~/.ssh/id_ed25519.pub --title "$(hostname -s)"
git remote set-url origin git@github.com:hkdobrev/dotfiles.gitPull the latest dotfiles:
cd && git pullUpdate all your software with the update alias (macOS software updates,
Homebrew formulae and casks, npm globals and Ruby gems):
updateIf ~/.path exists it is sourced before the other files, so it can extend
$PATH before any feature detection runs:
export PATH="$HOME/utils:$PATH"If ~/.extra exists it is sourced as well. Use it for machine-specific or
private settings, functions and aliases that you don't want to commit — a handy
way to tweak things without forking the whole repo.
Git loads additional configuration from ~/git/.gitconfig.local (untracked).
Use it to set your own identity:
git config --file=~/git/.gitconfig.local user.name "John Doe"
git config --file=~/git/.gitconfig.local user.email "john.doe@example.com"
git config --file=~/git/.gitconfig.local user.signingKey "0xABCDE"Suggestions/improvements welcome!
| Haralan Dobrev |
|---|
Originally forked from Mathias Bynens’ dotfiles and heavily modified since for my own purposes.
- @ptb and his OS X Lion Setup repository
- Ben Alman and his dotfiles repository
- Chris Gerke and his tutorial on creating an OS X SOE master image + Insta repository
- Cãtãlin Mariş and his dotfiles repository
- Gianni Chiappetta for sharing his amazing collection of dotfiles
- Jan Moesen and his ancient
.bash_profile+ shiny tilde repository - Lauri ‘Lri’ Ranta for sharing loads of hidden preferences
- Matijs Brinkhuis and his dotfiles repository
- Nicolas Gallagher and his dotfiles repository
- Sindre Sorhus
- Tom Ryder and his dotfiles repository
- Kevin Suttle and his dotfiles repository and OSXDefaults project, which aims to provide better documentation for
~/.osx - anyone who contributed a patch or made a helpful suggestion