chezmoi Dotfile manager
Light · Postcard
102 × 152 mm · PDF
Dark · Postcard
102 × 152 mm · PDF
Ink saver · Postcard
102 × 152 mm · PDF
Light · A4 landscape
297 × 210 mm · PDF
Dark · A4 landscape
297 × 210 mm · PDF
Ink saver · A4 landscape
297 × 210 mm · PDF
Light · A3 landscape
420 × 297 mm · PDF
Dark · A3 landscape
420 × 297 mm · PDF
Ink saver · A3 landscape
420 × 297 mm · PDF
Start here
chezmoi init <user>
chezmoi add <file>
chezmoi edit <file>
chezmoi diffchezmoi applychezmoi statuschezmoi updatechezmoi cdConcepts
- Source dir ~/.local/share/chezmoi
- Target state computed per machine
- Destination your home dir
- Source dir back into the repo
Setup
chezmoi initchezmoi init <user>
chezmoi init --apply <user>
chezmoi cdManage files
chezmoi add <file>
chezmoi add --template <file>
chezmoi re-addchezmoi edit <file>
chezmoi edit --apply <file>
Inspect and apply
chezmoi diffchezmoi applychezmoi apply -n -v
chezmoi statuschezmoi managedchezmoi updatechezmoi git -- <args>
Templates and data
chezmoi datachezmoi execute-template '<tmpl>'
| Variable | Value |
|---|---|
.chezmoi.os |
linux, darwin, windows |
.chezmoi.arch |
amd64, arm64 |
.chezmoi.hostname |
Short hostname |
.chezmoi.username |
Current user |
.chezmoi.homeDir |
Home directory |
.chezmoi.sourceDir |
Source directory |
{{ if eq .chezmoi.os "darwin" -}}export BROWSER=open{{ else -}}export BROWSER=xdg-open{{ end -}}
Source naming
| Name | Effect |
|---|---|
dot_zshrc |
Target .zshrc |
private_ |
No group/world access |
executable_ |
Mark executable |
readonly_ |
Remove write bits |
symlink_ |
Create a symlink |
exact_ |
Delete unmanaged children |
encrypted_ |
Stored encrypted |
create_ |
Write only if missing |
modify_ |
Script that edits a file |
remove_ |
Delete the target |
| Name | Effect |
|---|---|
file.tmpl |
Contents are a template |
run_<name> |
Run script on every apply |
run_once_<name> |
Run once per content |
run_onchange_<name> |
Run when content changes |
before_ / after_ |
Script ordering vs files |
.chezmoiignoreSecrets and externals
Global flags
-n / --dry-run-v / --verboseRecipes
chezmoi init --apply <user>chezmoi status# later: pick up changeschezmoi update
chezmoi add ~/.config/nvimchezmoi edit ~/.config/nvim/init.luachezmoi diffchezmoi apply
chezmoi cdgit add -Agit commit -m "Update dotfiles"git push
# dot_gitconfig.tmpl[user] name = {{ .name | quote }} email = {{ .email | quote }}



