Questions about why chezmoi works the way it does, and the reasoning behind key design decisions.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/twpayne/chezmoi/llms.txt
Use this file to discover all available pages before exploring further.
Do I have to use `chezmoi edit` to edit my dotfiles?
Do I have to use `chezmoi edit` to edit my dotfiles?
chezmoi edit is a convenience command with useful features, but there are multiple ways to edit your dotfiles.Option 1: Use chezmoi edit (recommended for most users)- Automatically handles encryption/decryption
- Works with target paths (not source paths)
- Syntax highlighting works correctly
- Can auto-apply changes with
--apply - Integrates with git auto-commit/push
Why doesn't chezmoi use symlinks like GNU Stow?
Why doesn't chezmoi use symlinks like GNU Stow?
- Home directory files are symlinks pointing to a central directory
- Your dotfiles are “special” (they’re actually symlinks)
- Changes to the central directory are immediately visible
- Home directory files are regular files
- Your dotfiles are “normal” (no special symlink behavior)
- Provides features impossible with symlinks (encryption, templates, private files)
- Advanced features:
- Encrypted files (can’t symlink to ciphertext)
- Template files (can’t symlink to template source)
- Private files (can’t control permissions via symlink)
- Executable files (git doesn’t track executable bit)
- Cross-platform compatibility:
- Windows has limited symlink support
- No permission issues on Windows
- Works the same everywhere
- Security:
- Encrypted secrets stay encrypted
- Private files have correct permissions
- No accidental exposure via symlink
What are the limitations of chezmoi's symlink mode?
What are the limitations of chezmoi's symlink mode?
- Encrypted files - The source contains ciphertext, not plaintext
- Executable files - Source files must be regular files for portability
- Private files - Git doesn’t persist group/world permission bits
- Template files - The source contains the template, not the result
- Entire directories - Attributes and exact_ behavior don’t work
- Running
chezmoi adddoesn’t immediately create symlinks - You must run
chezmoi applyto create symlinks - Mixed file types in the same directory can be confusing
- You have simple dotfiles without templates or encryption
- You want immediate visibility of changes
- You’re transitioning from GNU Stow
- You need encryption
- You want machine-specific configurations (templates)
- You manage dotfiles on Windows
- You need executable or private files
Why does chezmoi use weird filenames?
Why does chezmoi use weird filenames?
dot_bashrc, private_dot_ssh) is a deliberate design choice with important benefits.The criticism:- Filenames are verbose and unusual
- Not all file permissions can be represented
- Everything is in a single directory
- Metadata in filenames is universal
- Almost all programs store metadata in filenames (the extension)
- chezmoi extends this to prefixes (attributes)
- Transparency and clarity
dot_makes it obvious which files are managed- Files starting with
.are ignored by chezmoi (for version control) - No special whitelists needed for
.git,.gitignore, etc.
- Simplicity and atomicity
- Each file’s metadata is stored with the file
- Adding/removing a file touches only that file
- Changing attributes is a simple rename
- No need to parse/update a central config file
- Version control friendly
- Changes to metadata are simple git operations
- Easy to see what changed in git history
- Comments and formatting are never lost
0o644,0o755,0o600,0o700,0o444,0o555,0o400,0o500- Directories:
0o755,0o700,0o500
.chezmoiroot:home/ subdirectory, keeping the repo root clean.Backwards compatibility:chezmoi has many users, so the filename convention must remain stable. Any changes would need to:- Be fully backwards-compatible
- Fix a genuine real-world problem
- Work across all operating systems
- Not add significant complexity
Can chezmoi support multiple sources or multiple source states?
Can chezmoi support multiple sources or multiple source states?
- Ambiguous user interface:
chezmoi add ~/.bashrc- which source should this go to?- How does the user specify their preference?
- Overlapping targets:
- What if two sources both want to set
$EDITORin.bashrc? - How do you handle mutually exclusive configs (vim vs emacs)?
- What if two sources both want to set
- Dependencies between sources:
- Should shell completions be with the app or the shell?
- Hard to maintain clean separation
- Templates for minor differences
.chezmoiignoreto exclude files on certain machines- Password managers for secrets (not stored in repo)
- Externals to pull in third-party dotfiles
run_ script to invoke a second chezmoi instance. See felipecrs/dotfiles for an example.Why does `chezmoi cd` spawn a shell instead of just changing directory?
Why does `chezmoi cd` spawn a shell instead of just changing directory?
chezmoi cd, it’s running as a child process of your shell - it can only change its own directory, not your shell’s.The workaround:Create a shell function instead:chezmoi-cd or ccd changes your current shell’s directory.Why are the `prompt*` functions only available in config file templates?
Why are the `prompt*` functions only available in config file templates?
promptString, promptBool, and similar functions only work during chezmoi init because prompting during normal operations would be disruptive.The problem:chezmoi executes templates for many commands:chezmoi applychezmoi diffchezmoi status- Many others
Why not use Ansible/Chef/Puppet/Salt to manage dotfiles?
Why not use Ansible/Chef/Puppet/Salt to manage dotfiles?
- Simplicity:
- Single binary, no dependencies
- Small, focused feature set
- Easy to learn (not a full configuration management system)
- Easy installation:
- Copy one binary - done
- No scripting runtime required
- No packages to install
- No system services needed
- No root access required
- Runs everywhere:
- ARM-based Linux systems
- Windows desktops
- Lightweight containers
- FreeBSD VMs
- Any platform with a binary available
- User focus:
- Designed for personal configurations
- No need to learn system administration concepts
- Quick to get started
- You need to manage system configuration (not just dotfiles)
- You’re managing multiple users or servers
- You need complex orchestration
- You already know these tools
.chezmoiignore so they don’t pollute your home directory.Can I use chezmoi to manage files outside my home directory?
Can I use chezmoi to manage files outside my home directory?
- Managing personal dotfiles in your home directory
- Running without root access
- User-level configuration
- System-wide configuration files
- Managing
/etc/ - Multi-user setups
run_ script to handle a few files:- Package management
- Service configuration
- Multi-user setups
- Privilege escalation
- System state management
.chezmoiignore.What inspired chezmoi?
What inspired chezmoi?
- Requires Ruby and many dependencies
- Needs system services running
- Requires root access to install
- Has a steep learning curve
- Designed for managing servers, not personal configs
- The concept of desired state vs. current state
- Idempotent operations
- Declarative configuration
- Dry-run mode (diff before apply)
- Single binary with no dependencies
- User-focused (no root required)
- Simplified feature set
- Cross-platform support
- Designed specifically for dotfiles