Stians Tech Tips logoStians Tech Tips

Chezmoi

dotfiles·git·command-line

chezmoi

chezmoi keeps your dotfiles (all those .bashrc, editor, and app config files scattered around your home folder) in a single git repository, so you can version them and sync them across every machine you use.

It stores a “source” copy of each file, and chezmoi apply writes them back out to the right places. Because the source is just a git repo, you get history, branches, and an off-site backup for free. It also handles the parts that make real dotfiles awkward: templating for per-machine differences, and keeping secrets out of the repo.

Install it with winget on Windows:

winget install twpayne.chezmoi

or on Arch Linux:

sudo pacman -S chezmoi

The everyday workflow is short:

chezmoi add ~/.bashrc      # start tracking a file
chezmoi edit ~/.bashrc     # edit the source version
chezmoi apply              # write the changes back out
chezmoi cd                 # jump into the source repo to commit and push

I keep chezmoi aliased to dot in my shell config, so day to day these are just dot add, dot edit, and dot apply.

Setting up a brand new machine then becomes a one-liner:

chezmoi init --apply <your-github-username>

I use it to manage my Hyprland desktop config, so my whole setup is one git push away, and one chezmoi init on the next machine.