macOS Setup
Personal macOS dotfiles and setup scripts powered by Homebrew, proto, and Oh My Zsh.
Prerequisites
The init script checks for both prerequisites at startup and offers to install them automatically. Homebrew's installer script is fetched at the commit pinned in os/helpers/homebrew.sh and runs only when it matches the SHA-256 pinned there; it then installs Homebrew's latest release.
| Prerequisite | Check | Install |
|---|---|---|
| Xcode Command Line Tools | xcode-select -p | xcode-select --install |
| Homebrew | brew --version | brew.sh |
Installation
Remote (fresh machine)
# Full install — all profiles, dotfiles, completions
bash <(curl -fsSL https://raw.githubusercontent.com/KevinDeBenedetti/dotfiles/v0.20.0/os/macos/init.sh) -aThe script clones the latest release of the repository to ~/.dotfiles (or checks that release out in an existing clone), then re-executes from there. Set DOTFILES_REF to run another tag or branch (DOTFILES_REF=main). Using a permanent path ensures symlinks remain valid after reboot.
Local
# Clone
git clone https://github.com/KevinDeBenedetti/dotfiles.git ~/.dotfiles
cd ~/.dotfiles
# Full install
./os/macos/init.sh -a
# Dotfiles only
./os/macos/init.sh -d
# Specific profiles + completions
./os/macos/init.sh -p "base,python" -cFlags
| Flag | Description |
|---|---|
-a | Full install: all profiles + dotfiles + completions + cleanup |
-p <profiles> | Comma-separated list of profiles (e.g. base,javascript) |
-d | Link dotfiles into $HOME |
-c | Install zsh CLI completions |
-l | Lite mode — skip optional/heavy packages |
-h | Print help |
At least one flag is required. Running without flags prints help and exits.
Profiles
base
Core CLI tools installed via Homebrew. Split into lite (always) and additional (full mode only).
proto is installed from a pinned, SHA-256-checked release tarball (not Homebrew, no installer script) by
os/helpers/proto.sh, which runs automatically with thebase,javascriptandpythonprofiles. Before thejavascriptandpythonprofiles install anything, the script also linksconfig/proto/.prototools, so the pinned versions apply even with-p javascriptalone. All tool versions are declared inconfig/proto/.prototools(symlinked to~/.proto/.prototools).
Lite:
| Tool | Description |
|---|---|
ansible | Agentless configuration management and provisioning |
cheat | Community-driven command cheatsheets |
direnv | Per-directory environment loader |
fzf | Fuzzy finder for shell history, files, and more |
gettext | GNU gettext utilities (envsubst, …) |
| Git Credential Manager | HTTPS Git credential helper behind credential.helper = manager (cask) |
helm | Kubernetes package manager |
kubectl | Kubernetes command-line client |
sshs | Interactive SSH host selector (reads ~/.ssh/config) |
terraform | Infrastructure as code |
tree | Directory tree visualizer |
watch | Repeat a command at intervals |
yq | Portable YAML/JSON/TOML processor |
rsync | Incremental file transfer |
Git Credential Manager's installer runs
git-credential-manager configure, which writes to~/.gitconfig. On a fresh machine this happens before the dotfiles are linked; on a machine already linked, checkgit diff config/git/.gitconfigafterwards.
Additional (full mode):
| Tool | Description |
|---|---|
gh | GitHub CLI — PRs, issues, repos from the terminal |
k9s | Terminal UI for Kubernetes clusters |
lazygit | Terminal UI for Git |
lazydocker | Terminal UI for Docker |
nmap | Network exploration and port scanning |
| Docker Desktop | Docker engine, CLI and Compose |
| Browsers | Brave, Firefox, Arc |
| Apps | Insomnia, Mattermost, OpenVPN Connect |
javascript
Installs Node.js and package managers via proto. Pinned versions are read from config/proto/.prototools — no versions are hardcoded in the script.
Lite:
| Tool | Version declared in |
|---|---|
node | .prototools |
npm | .prototools (bundled with node) |
Additional (full mode):
| Tool | Description |
|---|---|
bun | Fast all-in-one JS runtime and bundler |
pnpm | Efficient disk-space-saving package manager |
yarn | Alternative npm-compatible package manager |
@antfu/ni | Universal package manager wrapper (ni, nr, nun…) |
python
Installs Python via proto and tooling via uv. The pinned version is read from config/proto/.prototools — no version is hardcoded in the script.
Lite:
| Tool | Version declared in |
|---|---|
python | .prototools |
uv | Homebrew (latest) — fast Python package manager |
Additional (full mode):
| Tool | Description |
|---|---|
ruff | Extremely fast Python linter and formatter |
ipython | Enhanced interactive Python shell |
httpie | User-friendly HTTP client for the terminal |
ai
Full mode only.
| Tool | Description |
|---|---|
ollama | Run large language models locally |
extras
Personal applications.
Lite: VLC
Additional (full mode): Audacity, Discord, Spotify, Raspberry Pi Imager, Macs Fan Control, Radio Silence, kDrive
Dotfiles Linking
Running -d symlinks (or copies) config files from the repository into $HOME. Any existing file is backed up with a datestamp (e.g. ~/.zshrc.bak.20260311) before being replaced.
| Source | Target | Method |
|---|---|---|
config/zsh/.zshrc | ~/.zshrc | copy¹ |
config/git/.gitconfig | ~/.gitconfig | symlink |
config/git/ignore | ~/.config/git/ignore | symlink |
config/proto/.prototools | ~/.proto/.prototools | symlink |
config/oh-my-zsh/*.zsh-theme | ~/.oh-my-zsh/custom/themes/ | symlink |
config/shell/* | ~/.config/dotfiles/ | symlink |
config/ssh/config | ~/.ssh/config | symlink |
config/claude/settings.json | ~/.claude/settings.json | symlink |
config/claude/hooks/* | ~/.claude/hooks/ | symlink |
config/skills/*/ | ~/.claude/skills/ | symlink |
config/skills/*/ | ~/.copilot/skills/ | symlink |
config/skills/*/SKILL.md | ~/.config/opencode/commands/*.md | symlink³ |
config/agents/AGENTS.md | ~/.claude/AGENTS.md | symlink |
config/claude/CLAUDE.md | ~/.claude/CLAUDE.md | symlink |
config/agents/AGENTS.md | ~/.config/opencode/AGENTS.md | symlink |
config/agents/AGENTS.md | ~/.copilot/copilot-instructions.md | symlink |
config/opencode/opencode.json | ~/.config/opencode/opencode.json | symlink |
config/copilot/hooks/* | ~/.copilot/hooks/ | symlink |
config/ai-tools/ | ~/.config/ai-tools | symlink |
scripts/*/* (executables) | ~/.local/bin/ | symlink |
config/ollama/ | ~/.config/ollama | symlink |
config/ollama/launchd/*.plist | ~/Library/LaunchAgents/ | symlink |
config/vscode/settings.json | ~/Library/Application Support/Code/User/settings.json | symlink² |
config/vscode/mcp.json | ~/Library/Application Support/Code/User/mcp.json | symlink² |
¹
.zshrcis copied rather than symlinked because the init script applies macOS-specific patches:gsedalias and Homebrew paths for Apple Silicon (/opt/homebrew).² Only when VS Code is installed:
settings.jsonandmcp.jsonneed thecodeCLI onPATH.³ Only for a user-invoked skill (a slash command): see Agent Skills.
TIP
These links point at the checkout the init script ran from. Run it from a clean checkout such as ~/.dotfiles rather than a working copy that AI agents edit — see Claude Code.
Completions
Running -c installs zsh completions for the following tools (placed in $(brew --prefix)/share/zsh/site-functions):
| Tool | Source |
|---|---|
fzf | Homebrew integration (--completion --key-bindings) |
gh | gh completion -s zsh |
proto | proto completions --shell zsh |
uv | uv generate-shell-completion zsh |
Zsh Configuration
The .zshrc at config/zsh/.zshrc is copied (not symlinked) to ~/.zshrc so that macOS-specific patches can be applied without affecting the tracked file.
History
| Setting | Value | Effect |
|---|---|---|
HISTSIZE | 10000 | Number of commands kept in memory per session |
SAVEHIST | 10000 | Number of commands persisted to ~/.zsh_history |
HIST_STAMPS | yyyy-mm-dd | Date prefix on every history entry |
HISTFILE | ~/.zsh_history | Persistent history file location |
Theme
A custom Oh My Zsh theme kevin-de-benedetti is linked from config/oh-my-zsh/ into ~/.oh-my-zsh/custom/themes/ and set via ZSH_THEME.
Plugins
The following Oh My Zsh plugins are enabled in .zshrc. Plugins must be listed before source $ZSH/oh-my-zsh.sh.
| Plugin | What it provides |
|---|---|
aliases | als command — lists all active aliases with descriptions |
brew | Brew completion and bubo/bubc/bubu update aliases |
colored-man-pages | ANSI colour for man pages — much easier to read |
direnv | Loads .envrc files with direnv, installed by the base profile |
docker | Docker CLI completion and aliases (dbl, dcin, dco, dps, etc.) |
docker-compose | docker compose completion and shorthand aliases (dco, dcup, dcdown, etc.) |
gh | GitHub CLI (gh) shell completion |
git | Extensive Git aliases (gst, gco, glog, gcmsg, etc.) and branch in prompt |
gitignore | gi <lang> — fetches a .gitignore template from gitignore.io |
rsync | Aliases for common rsync patterns (rsync-copy, rsync-move, etc.) |
sudo | Double-press ESC to prepend sudo to the current or previous command |
Built-in Aliases
Key aliases defined in .zshrc (beyond plugin aliases):
| Alias | Expands to | Purpose |
|---|---|---|
bcu | brew outdated --cask --greedy | xargs brew reinstall | Upgrade all outdated Homebrew casks in one shot |
cs | cheat_glow | Render a cheat sheet with glow |
dsp | docker system prune -a -f | Free all unused Docker resources |
hs | history | grep | Case-sensitive history search |
hsi | history | grep -i | Case-insensitive history search |
k | kubectl | Short Kubernetes client |
kc | kubectx | Switch Kubernetes context |
kg | kubectl get | List Kubernetes resources |
kl | kubectl logs | Stream pod logs |
kn | kubens | Switch Kubernetes namespace |
lad | lazydocker | Terminal UI for Docker |
lag | lazygit | Terminal UI for Git |
pubip | dig +short txt ch whoami.cloudflare @1.0.0.1 | Show your public IP address |
vup | vpn up | Bring a WireGuard tunnel up (wg-quick up) |
vdown | vpn down | Bring a WireGuard tunnel down (wg-quick down) |
vpns | vpn status | Show active WireGuard tunnels (wg show) |
arm | arch -arm64 /bin/zsh (macOS only) | Start an ARM64 shell on Apple Silicon |
intel | arch -x86_64 /bin/zsh (macOS only) | Start a Rosetta (x86_64) shell |
gs | git status (macOS only) | Show the working tree status |
fzf Integration
fzf is installed by the base profile. The tracked .zshrc adds the fzf Oh My Zsh plugin whenever fzf is on PATH, which turns on its completion and these key bindings:
| Binding | Action |
|---|---|
CTRL-T | Fuzzy-search files/directories and paste the path |
CTRL-R | Fuzzy-search command history and run selected entry |
ALT-C | Fuzzy cd into a subdirectory |
cheat is also configured with CHEAT_USE_FZF=true so cheat queries are piped through fzf for interactive selection.
Local Overrides
The following files are sourced at the end of .zshrc if they exist. They are never tracked by git and always take precedence:
| File | Purpose |
|---|---|
~/.config/dotfiles/env.local.sh | Machine-specific environment variables (no API keys) |
~/.zshrc.local | Machine-specific aliases, path additions, and exports |
Shell Functions
Custom functions live in config/shell/functions.sh and are sourced automatically by .zshrc. Run lsfn to list all functions with their help text.
| Function | Usage | Description |
|---|---|---|
b64d | b64d <string> | Decode a base64 string |
b64e | b64e <string> | Encode a string to base64 |
browser | browser [-- <url>] | Start a Browsh terminal browser via Docker |
brewsuggest | brewsuggest | List suggested Homebrew CLI tools, installed (✓) or missing (○) |
cheat_glow | cheat_glow <sheet> | Render a cheat cheatsheet through glow at 150 columns for readability |
check_cert | check_cert <url> | Print TLS certificate details for a domain using curl |
cleanmac | cleanmac [--yes [target...]] | Free disk space (caches, logs, Trash, Homebrew, DNS); a dry run without --yes |
dks | dks <secret> [namespace] | Decode a Kubernetes secret — outputs all .data values base64-decoded via yq |
kbp | kbp <port> | Kill the process currently listening on the given TCP port |
randompass | randompass [length] | Generate a secure random password (default 24 chars) with mixed complexity |
timestampd | timestampd <unix_ts> | Convert a Unix timestamp to a human-readable date (cross-platform) |
timestampe | timestampe <YYYY-mm-ddTHH:MM:ss> | Convert a date string to its Unix timestamp (cross-platform) |
vpn | vpn <up|down|status|list> [tunnel] | Manage WireGuard tunnels via wg-quick (aliases: vup, vdown, vpns) |
Run any function with
-hor--helpto see its usage message, e.g.dks -h.
Git Configuration
config/git/.gitconfig is symlinked to ~/.gitconfig. Key settings:
| Section | Setting | Value | Effect |
|---|---|---|---|
user | useConfigOnly | true | Identity must come from a config file, never guessed |
push | default | simple | Push to the tracking branch only (safe default) |
pull | rebase | true | Always rebase on pull instead of merge |
branch | autosetuprebase | always | New branches track their remote with rebase |
rerere | enabled | true | Record and replay conflict resolutions automatically |
commit | gpgsign | true | Sign every commit with your SSH key |
tag | gpgSign | true | Sign every tag with your SSH key |
gpg | format | ssh | Use SSH key (not GPG keyring) for signing |
gpg.ssh | allowedSignersFile | ~/.ssh/allowed_signers | File that maps emails to trusted public keys |
init | defaultBranch | main | New repositories default to main |
credential | helper | manager | HTTPS auth through Git Credential Manager³ |
url | insteadOf | git@github.com: | GitHub SSH remotes are rewritten to HTTPS (GCM) |
diff | tool | meld | Use Meld as the visual diff tool |
³ Git Credential Manager is installed by the
baseprofile. Details in Git.
Machine-specific overrides
Create ~/.gitconfig.local with any section you want to override locally — it cannot be committed since it is excluded from the repository:
# ~/.gitconfig.local — never tracked by git
[user]
email = work@company.com
signingkey = ~/.ssh/id_ed25519_work.pubSSH commit signing
The dotfiles install adds the signing key to ~/.ssh/allowed_signers: the key in user.signingkey, else the first of ~/.ssh/id_ed25519.pub, id_ecdsa.pub and id_rsa.pub. It updates that key's line only, keeping any other signer in the file. This allows Git to verify signed commits locally with git log --show-signature.
SSH Client Configuration
config/ssh/config is symlinked to ~/.ssh/config. The global Host * block applies to every connection:
| Directive | Value | Effect |
|---|---|---|
SendEnv -LC_* -LANG | (off) | Do not forward locale variables — avoids setlocale warnings on servers |
ControlMaster | auto | Reuse an existing connection if one is already open |
ControlPath | ~/.ssh/cm-… | Socket path for multiplexed connections |
ControlPersist | 60s | Keep the master connection open for 60 s after the last session closes |
ServerAliveInterval | 60 | Send a keepalive packet every 60 s |
ServerAliveCountMax | 3 | Drop the connection after 3 missed keepalives (~3 min) |
proto Toolchain
config/proto/.prototools is symlinked to ~/.proto/.prototools. It pins global tool versions and configures proto's behaviour:
# bun, node, pnpm, yarn, python and go: one exact version each
# (see the file for the numbers)
npm = "bundled" # ships with the Node.js version
[tools.node]
bundled-npm = true # keep npm in sync with node
[tools.npm]
shared-globals-dir = true # global npm packages in a single shared dir
[settings]
auto-install = true # install missing tool versions automatically
auto-clean = true # remove unused tool versions after upgrades
pin-latest = "global" # record the resolved "latest" version globallyManaging tool versions
# Install a specific version
proto install node 22
# Install a version and pin it in the current directory only (./.prototools)
proto install node 20 --pin local
# List the configured tools and whether each is installed
proto status
# Upgrade proto itself
proto upgradeHomebrew Tips
# Update all installed packages
brew update && brew upgrade
# Remove outdated versions
brew cleanup
# List installed formulae
brew list --formula
# List installed casks
brew list --cask
# Check for issues
brew doctorCommon Issues
Xcode CLT broken after macOS update:
sudo rm -rf /Library/Developer/CommandLineTools
xcode-select --installHomebrew not found on Apple Silicon:
eval "$(/opt/homebrew/bin/brew shellenv)"The init script and the tracked .zshrc both do this themselves when brew is installed under /opt/homebrew or /usr/local but not on PATH. Run the line by hand in a shell that loads neither, such as a terminal opened before the dotfiles were linked.