HeadlinesBriefing favicon HeadlinesBriefing.com

Why I Switched from GNU Stow to Chezmoi for Dotfile Management

Hacker News •
×

Managing dotfiles across multiple Macs with GNU Stow became a maintenance nightmare. The symlink-based approach meant edits on any machine wrote directly to the git repository, leaving dirty working trees and merge conflicts. With a MacBook Pro, Air, and Mini all sharing configurations, keeping three repository clones synchronized required constant manual intervention.

Chezmoi replaces symlinks with real file copies, making the source directory the single source of truth. Its chezmoi add command captures live configuration files into ~/.local/share/chezmoi, where dot_zshrc maps to ~/.zshrc automatically. The tool supports Go templates with .tmpl suffix for machine-specific settings, and private_prefix attributes for permission management. Unlike Stow, changes only flow when explicitly applied.

The real advantage shows in bootstrapping new machines. After Homebrew installs, two commands pull the repository and apply everything: chezmoi init --apply with pre-answered prompts. Scripts in .chezmoiscripts/ run automatically during setup, with run_onchange_ prefixes ensuring Homebrew packages only reinstall when the Brewfile changes. This eliminates the manual cleanup Stow required when existing config files blocked symlink creation.

The author tracks shell configs, git settings split by work/personal directories, and agent tool configurations for Claude Code and Codex. This approach centralizes configuration management while avoiding Stow's multi-device synchronization headaches. The transition represents a practical shift from symlink-based to copy-based dotfile management.