This page looks best with JavaScript enabled

Using chezmoi to manage dotfiles

 ·  ☕ 2 min read

chezmoi helps you manage your personal configuration files (dotfiles, like ~/.bashrc) across multiple machines. It has strong support for security, allowing you to manage secrets (e.g. passwords, access tokens, and private keys) securely and seamlessly using a password manager of your choice or GnuPG encryption.
Source code available at GitHub.


You can install chezmoi using your package manager or by runnig the following command:

curl -sfL | sh

This will install correct binary in ./bin.


If you have installed a pre-built binary of chezmoi, you can upgrade it to the latest release with:

chezmoi upgrade

Basic usage

  • Initialize chezmoi repository:

    chezmoi init

    This will create a new git repository in ~/.local/share/chezmoi with permissions 0700 where chezmoi will store the source state. chezmoi only modifies files in the working copy. It is your responsibility to commit changes.

  • Manage an existing file with chezmoi:

    chezmoi add ~/.bashrc

    This will copy ~/.bashrc to ~/.local/share/chezmoi/dot_bashrc. Use -r to add whole folder.

  • Edit source state of configuration file:

    chezmoi edit ~/.bashrc

    This will open ~/.local/share/chezmoi/dot_bashrc in your $EDITOR.

  • See what changes will be made:

    chezmoi diff
  • Apply changes to actual dotfiles:

    chezmoi -v apply

    Add -v for verbose output and -n for dry run.

  • Restore dotfiles on another machine:

    chezmoi init
    chezmoi apply
  • Launch a shell in the source directory:

    chezmoi cd
  • List the managed files in the destination directory:

    chezmoi managed
  • Remove a target from the source state (stop managing):

    chezmoi forget ~/.bashrc
  • Pull latest changes from repository:

    chezmoi update

Read more

chezmoi have much more functionality.

What's on this Page