Skip to content
dxnterPublic

About

⚙️ Automated configuration, preferences, and software installations for macOS

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

cover

dotfiles

Platform

Automated macOS setup: Homebrew packages from a Brewfile, language runtimes from mise, symlinked shell and Git config, and system preferences. Works on Apple Silicon and on Intel Macs running macOS 13 or later.

⚠️ Warning: This is catered to my own use. Fork it, review system/setup.sh and the Brewfile, and adjust before running it.

🔧 Setup

✅ Requirements

Update macOS and install the Xcode Command Line Tools. On Apple Silicon, Rosetta 2 is only needed for apps that still ship Intel-only builds.

sudo softwareupdate -i -a
xcode-select --install

# Apple Silicon, optional
sudo softwareupdate --install-rosetta --agree-to-license

🚀 Installation

git clone https://github.com/dxnter/dotfiles.git ~/.dotfiles
cd ~/.dotfiles
make

make sets the hostname, installs Homebrew and everything in the Brewfile, sets Homebrew's zsh as the login shell with oh-my-zsh, links the config files, installs mise and its runtimes and tools, applies system preferences, and restarts.

Existing files that would block a symlink are moved into ~/.dotfiles/backup/ rather than overwritten. To copy the current versions there before running anything, use make backup.

After the restart, fill in name and email in ~/.gitconfig.local, turn on 1Password's SSH agent (Settings → Developer → Use the SSH agent), then set up the SSH key for GitHub. The private key lives in 1Password and never touches disk; 1Password asks for approval when an app first uses it, and Settings → Developer sets how long that approval lasts. The script uses the SSH Key item titled after the Mac's local hostname, or creates one with the 1Password CLI. It writes the public key to ~/.ssh/<hostname>.pub, pins github.com to that key, and adds it to GitHub as an Authentication Key. If gh isn't signed in, it copies the key and opens GitHub's new-key page instead.

Commits are signed by a second key that belongs to the Mac, ~/.ssh/<hostname>-signing, which never prompts, so an agent working overnight or a launchd job still signs instead of turning signing off. GitHub knows it only as a Signing Key, so it can't log in or push. make ssh creates it, copies it to the clipboard and opens GitHub's new-key page: add it as a Signing Key titled <hostname> (machine). It's added in the browser on purpose: gh's token never gets the right to add signing keys, so a stolen token can't sign its way past config-sync. make ssh also trusts every signing key on the account in ~/.config/git/allowed_signers, so git log --show-signature recognises the other Macs; rerun it after adding a Mac.

make ssh

💡 Make targets

Target What it does
make Full setup
make brew Install or update everything in the Brewfile
make mise Install the runtimes in ~/.config/mise/config.toml
make links Symlink every package listed in symlink_dirs
make unlink Remove those symlinks
make prefs Apply macOS preferences only
make backup Copy current dotfiles into backup/
make ssh Set up a 1Password ed25519 key for GitHub, this Mac's commit-signing key, and gh for HTTPS credentials
make vscode Install each VS Code profile's extensions from vscode/profiles/ and remove the rest
make dev-sync Schedule dev-sync (daily at 09:30 and at login); skipped on a work Mac
make config-sync Schedule config-sync (every 15 minutes and at login)

💾 Software

Homebrew installs apps, fonts and a few CLI tools from the Brewfile. Homebrew 7 stopped publishing binaries for Intel Macs, so on any Intel Mac (including one running a newer macOS through OpenCore Legacy Patcher) it would compile most formulae from source; there the Brewfile installs only formulae that still have binaries and relies on macOS's own zsh, git, curl, grep, sed and tar. Every Mac gets the same apps. When a current cask needs a newer macOS than the Mac has, the Brewfile installs a pinned cask from Casks/ instead: OrbStack 1.11.3 and ProtonVPN 5.1.0 on macOS 13. On those Macs the repo is tapped locally as dxnter/dotfiles. A work Mac skips the personal apps (VPNs, Little Snitch, Transmission, chat and media apps) and installs the casks in the Brewfile's if work block instead; see work Mac. Add a package with brew "name" or cask "name" and run make brew. Search with the package browser.

mise installs language runtimes and most CLI tools from mise/.config/mise/config.toml: Node 26, pnpm, Bun, Python, uv, Rust, Go, plus tools like bat, fd, ripgrep, gh, neovim, pandoc, ffmpeg, starship, http-server and grip. They're prebuilt binaries, so they install quickly on Intel Macs too, where Homebrew no longer publishes bottles. On macOS 13 and older, .zshenv sets MISE_ENV=legacy, which layers config.legacy.toml on top to pin the few tools whose newest builds need a newer macOS. On a work Mac, MISE_ENV=work layers config.work.toml on top for work-only tools. mise itself comes from its official installer. The global config tracks lts/latest; projects pin their own versions in mise.toml or .tool-versions. Update everything with mise upgrade.

Herd provides PHP, Composer and the local Laravel services. mise does not manage PHP.

Node comes from mise even though Herd installs its own nvm: .zprofile puts mise's shims on PATH for GUI apps and scripts, and .zshrc runs mise activate last, so mise wins. mise also switches Node from a project's .nvmrc or .node-version. Loading nvm costs about a second per shell, so .zshrc loads it only when nvm is called; keep Herd's source nvm.sh and nvm use lines out of ~/.zshrc.

Ghostty is the terminal. Its config lives in ghostty/.config/ghostty/config.ghostty: JetBrains Mono (Ghostty bundles Nerd Font symbols, so Starship and lsd icons need no patched font), the Carbonfox theme, and shell integration that keeps sudo and ssh working with Ghostty's terminfo. Reload it with ⌘⇧,.

The shell's other tools follow Carbonfox too. Starship defines the theme's colors as a named palette. bat and delta use the Carbonfox syntax theme in bat/.config/bat/themes; make links rebuilds bat's theme cache, which both read. lsd takes its colors from lsd/.config/lsd/colors.yaml and file-name colors from LS_COLORS in .zshrc. fzf and Tab completion (fzf-tab) get their colors and layout from FZF_DEFAULT_OPTS in .zshenv.

VS Code settings and keybindings live in vscode/ and are linked into ~/Library/Application Support/Code/User/. Settings Sync stays on and writes through the links, so every change shows up as a git diff. Each stack has its own profile (Laravel, Web, Python, Rust, Go, C++), and every profile uses the Default profile's settings, keybindings, snippets and tasks, so only the extensions differ. vscode/profiles/ lists them: core.txt goes into every profile, and each other file names its profile in a # profile: header. make vscode installs the lists and uninstalls anything a profile has that its list doesn't name. VS Code's CLI can't create profiles; on a new Mac, sign in to Settings Sync first and it brings them.

🎨 Customize

The zsh config is split by when zsh reads it:

  • zsh/.config/zsh/.zshenv → Environment variables read by every shell (no PATH, no commands, no secrets)
  • zsh/.config/zsh/.zprofile → PATH, built once per login shell; each entry is added only if the directory exists
  • zsh/.config/zsh/.zshrc → Interactive setup: oh-my-zsh, history, Starship, mise, and nvm loaded on first use
  • zsh/.config/zsh/.aliases and .functions → Aliases and functions

Note: ~/.zshrc and ~/.zprofile are not read by zsh here because ZDOTDIR is ~/.config/zsh. Installers still append to them, so the ZDOTDIR files source both at the end. Keep your own settings in the local files below.

`~/.zshrc.local`

Sourced after the aliases and functions, for machine-specific aliases and shell settings that stay out of version control.

Work Mac

Before running make on a work Mac, add this line to ~/.zshenv.local:

export MISE_ENV="${MISE_ENV:+$MISE_ENV,}work"

The Brewfile then installs the work cask list, mise adds config.work.toml, make leaves the hostname alone, and make prefs skips Software Update, the firewall and the dock layout, which MDM manages there.

`~/.zshenv.local`

Sourced at the end of .zshenv by every shell. Use it for machine-specific environment and for secrets, read from the login keychain rather than written in plain text:

export TF_VAR_local_state_passphrase="$(security find-generic-password -s tf-state-passphrase -w 2>/dev/null)"

Store a value with security add-generic-password -a "$USER" -s <service> -w '<value>' -U.

`~/.gitconfig.local`

Included after ~/.gitconfig. Keep the Git identity and signing key here. make ssh fills in the signing settings so commits are signed by the Mac's own key:

[user]
    name = John Doe
    email = jdoe@example.com
    signingKey = /Users/jdoe/.ssh/<hostname>-signing
[gpg]
    format = ssh
[gpg "ssh"]
    program = /usr/bin/ssh-keygen

`~/dev`

Every repository lives one level down in a group folder, the same on every Mac:

Folder Holds
~/dev/personal/ Your own projects
~/dev/oss/ Forks of and contributions to other people's projects
~/dev/ventures/ Startups, kept apart from personal projects

Repositories in all three use ~/.gitconfig.personal, included after ~/.gitconfig.local, so a work Mac can keep its work identity in .local and still commit personal work with your own email. GitHub is the hub between Macs: run dev-status to list repositories whose work exists only on the current Mac (it also finds them deeper down, such as a work Mac's ~/dev/work/apps/<repo>), and dev-status --fetch to also see commits pushed from another one. Inside a repository the prompt shows uncommitted (!), unpushed (⇡) and behind (⇣), and entering one says once per shell if it has never-pushed branches, no remote, or isn't in git.

Every personal Mac holds the same repositories. bin/dev-sync clones each repository you own on GitHub that isn't archived, isn't a fork and doesn't carry the topic no-sync, and registers it as a T3 Code project. A repository with the topic venture goes in ~/dev/ventures, agent-config in ~/.agents, dotfiles in ~/.dotfiles, and the rest in ~/dev/personal. When a repository is archived, its checkout goes to the Trash once nothing in it exists only on this Mac: no uncommitted, stashed or unpushed work and no ignored file a build can't remake. Otherwise dev-sync reports it and leaves it. It never fetches, pulls or touches anything else, and it refuses to run on a work Mac.

launchd runs it daily and at login, and catches up when a Mac wakes, so each Mac converges on its own whether or not the other is on. Its problems (a failed clone, a folder in the way, an archived checkout with local work, no run in three days) appear under dev-status in the first shell of the day. Run dev-sync --dry-run to see what a run would change.

dev-sync never pulls, because a project checkout may hold work in progress. The repositories this Mac runs on are different: dotfiles is linked into $HOME, agent-config's skills into each agent, and personal-os is what assistants read, so a change pushed from the other Mac should apply here on its own. Tag such a repository live-config on GitHub, and bin/config-sync keeps it at GitHub's main. launchd runs it every 15 minutes and at login, and catches up when a Mac wakes.

It fetches over HTTPS through gh, so it never asks 1Password for the SSH key, and it only fast-forwards: the checkout must be on main with nothing uncommitted or untracked, and every new commit must be signed by one of the SSH signing keys on your GitHub account. Anything else (an unsigned commit, local changes, another branch, history that has diverged) is left alone and reported under dev-status. After a pull it relinks added files, rebuilds bat's theme cache, reloads Ghostty's config and runs agent-config's install.sh as needed. Changes that install software or change system settings are not applied: a changed Brewfile, mise config, macOS preferences or VS Code extension list becomes a to-do (run make brew) that the next prompt and dev-status show, and the matching make target clears it. When a change touches zsh, open shells say once to run exec zsh.

A work Mac runs it too, for ~/.dotfiles and ~/.agents only: it has no dev-sync and holds no personal repositories, and the Brewfile and mise already pick the work lists there.

Run config-sync --dry-run to see what a run would do, and config-sync --undo dotfiles to step back to the commit before the last sync; it stays there until a newer commit reaches GitHub.

⏫ Adding Dotfiles

GNU Stow links each top-level package directory into $HOME. The contents of a package mirror their path relative to $HOME:

mise
└── .config
    └── mise
        └── config.toml

Add the package name to symlink_dirs, then link it:

echo 'mise' >> symlink_dirs
make links

⚙️ System Preferences

The full setup applies the preferences in system/preferences. To apply them on their own:

make prefs

👏 Acknowledgments

📝 License

Usage is provided under the MIT License.

About

⚙️ Automated configuration, preferences, and software installations for macOS

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Used by

Contributors

Languages