↓Skip to main content

Managing Dotfiles with Chezmoi

·2 mins

For the last few years I’ve maintained ansible playbooks for managing the software installed on my local workstation and the configuration files (dotfiles) in my home directory. The dotfiles contain some sensitive information so I haven’t made that playbook public, but the playbook for managing the installed software can be found here.

I’ve been making lots of small configuration changes lately and have been finding it a bit of a pain to keep the ansible playbook up-to-date, so I went looking for a tool designed specifically for managing dotfiles. It turns out there are quite a few of them: General-purpose dotfile utilities. After a bit of reading I decided to give chezmoi a try. It’s written in go so there’s just a single binary to install and packages are available for most platforms. The features I was looking for are:

  • Dotfiles must be kept under version control;
  • File permissions (read, write, execute flags) should be managed;
  • Selected files can be encrypted before being added to version control;
  • It should be possible to review changes before they are applied.

Chezmoi supports all of these requirements and more, including template support and the ability to run scripts before or after dotfiles are updated. It also comes with excellent documentation. For a gentle introduction, check out this podcast from Chit Chat Across The Pond.