Quick Start Guide
This guide will help you start using chezmoi to manage your dotfiles on your current machine and then sync them across multiple machines.Concepts
Roughly speaking, chezmoi stores the desired state of your dotfiles in the directory~/.local/share/chezmoi. When you run chezmoi apply, chezmoi calculates the desired contents for each of your dotfiles and then makes the minimum changes required to make your dotfiles match your desired state.
For a more detailed explanation, see the concepts reference.
Start Using chezmoi on Your Current Machine
Assuming you have already installed chezmoi, follow these steps to start managing your dotfiles:Initialize chezmoi
Create a new git repository where chezmoi will store its source state:This creates a new git local repository in
~/.local/share/chezmoi. By default, chezmoi only modifies files in the working copy.Manage your first file
Add your first dotfile to chezmoi:This will copy
~/.bashrc to ~/.local/share/chezmoi/dot_bashrc.Edit the source state
Edit the file in chezmoi’s source directory:This will open
~/.local/share/chezmoi/dot_bashrc in your $EDITOR. Make some changes and save the file.Preview changes
See what changes chezmoi would make:This shows you exactly what will change before you apply it.
Apply the changes
Apply your changes to your home directory:The
-v (verbose) flag prints out exactly what changes are being made. You can also use -n (dry run) to see what would happen without making actual changes.The combination
-n -v is very useful to see exactly what changes would be made without making them.Create a GitHub repository
Create a new repository on GitHub called
dotfiles and push your repo:Workflow Diagram
This diagram summarizes the workflow:Using chezmoi Across Multiple Machines
Once you’ve set up chezmoi on your first machine, you can easily sync your dotfiles to other machines.Initialize with your dotfiles repo
On a second machine, initialize chezmoi with your dotfiles repo:This will check out the repo and any submodules and optionally create a chezmoi config file for you.
Edit files if needed
If you’re not happy with changes to a specific file, you can:Edit the file:Or merge changes:This invokes a merge tool (by default
vimdiff) to merge changes between the current contents of the file, the file in your working copy, and the computed contents.Multi-Machine Workflow Diagram
Set Up a New Machine with a Single Command
You can install your dotfiles on a new machine with a single command:If you use GitHub and your dotfiles repo is called
dotfiles, you can use the shorthand $GITHUB_USERNAME instead of the full URL.Single-Command Setup Diagram
Common Commands Reference
Verbose and Dry Run Flags
Verbose and Dry Run Flags
All chezmoi commands accept these useful flags:
-vor--verbose: Print out exactly what changes will be made-nor--dry-run: Don’t make any actual changes-n -v: Combination to see exactly what would change without making changes
Essential Commands
Essential Commands
chezmoi init: Initialize chezmoichezmoi add <file>: Add a file to chezmoichezmoi edit <file>: Edit a file in the source statechezmoi diff: Show what would changechezmoi apply: Apply changes to your home directorychezmoi update: Pull and apply latest changes from repochezmoi cd: Open a shell in the source directory
Working with Git
Working with Git
chezmoi works seamlessly with Git. You can use chezmoi to manage your dotfiles repo:
Git Hosting Services
Git Hosting Services
chezmoi works with any git hosting service:
- GitHub
- GitLab
- Bitbucket
- Source Hut
- Any self-hosted git server
Next Steps
For a full list of commands, run:User Guide
Learn about templates, secrets management, and advanced features
Command Overview
Complete reference of all chezmoi commands
Daily Operations
Day-to-day workflows and best practices
Example Repos
See how other people use chezmoi