Do I have to use `chezmoi edit` to edit my dotfiles?
Do I have to use `chezmoi edit` to edit my dotfiles?
No, you don’t have to! Benefits:Option 3: Edit target, then re-addOption 4: Edit target, then mergeChoose the workflow that fits your style!
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?
chezmoi does support symlinks as first-class citizens - you can create, update, and remove symlinks, and even template them to point to different targets on different machines.However, unlike GNU Stow, chezmoi doesn’t require symlinks as a layer of indirection between your dotfiles and their content.GNU Stow approach:However, this has limitations (see limitations below).
- 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?
When you enable symlink mode, chezmoi creates symlinks back to the source directory where possible. However, many features require regular files:Cannot use symlinks for:
- 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?
chezmoi’s filename convention (like Now your dotfiles live in the
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?
chezmoi deliberately uses a single source of truth - one branch in one git repo. This is an opinionated design choice to avoid complexity and ambiguity.Why single source?Multiple sources create problems:Option 2: Combine sources before applyingOption 3: Nested chezmoi
Use a
- 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?
This is a technical limitation, not a design choice.The problem:
A program cannot change the working directory of its parent process. When you run Or as an alias:Now typing
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?
The Then use the values in other templates:Re-prompting:If you need to change answers:
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
.chezmoi.toml.tmpl
dot_gitconfig.tmpl
Why not use Ansible/Chef/Puppet/Salt to manage dotfiles?
Why not use Ansible/Chef/Puppet/Salt to manage dotfiles?
You can use full system management tools for dotfiles, but chezmoi is purpose-built for this specific use case.chezmoi advantages:Keep your Ansible playbooks in
- 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
run_once_configure_system.sh
.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?
Technically yes, but this is strongly discouraged for anything beyond simple cases.chezmoi is designed for:Or create a symlink:For anything more complex:Use proper system configuration management tools:These tools are designed for system-wide configuration and handle:
- 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:run_after_copy_system_file.sh
run_after_link_system_file.sh
- Package management
- Service configuration
- Multi-user setups
- Privilege escalation
- System state management
.chezmoiignore.What inspired chezmoi?
What inspired chezmoi?
chezmoi was inspired by Puppet, a powerful system configuration management tool.Why not just use Puppet?Puppet is excellent for its intended use case (system administration), but it’s overkill for personal dotfiles:
- 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