How Chezmoi Revolutionized My Multi-Computer Workflow

By David Cruz on Feb 15, 2025
#Developer Tools#Dotfiles#Productivity#DevOps#Automation
Developer workspace with multiple computers

How Chezmoi Revolutionized My Multi-Computer Workflow

As a developer who works across multiple machines—laptop, desktop, cloud instances, and various development environments—I used to dread setting up a new computer. The thought of manually configuring my shell, editor settings, aliases, and countless other dotfiles was enough to make me postpone migrations for months.

Then I discovered Chezmoi, and everything changed.

The Problem: Configuration Chaos

Before Chezmoi, my workflow looked something like this:

  • Manual copying of dotfiles between machines
  • Inconsistent configurations across different computers
  • Lost customizations when setting up new environments
  • Hours of setup time for each new machine
  • Fear of experimenting with new configurations (what if I break something?)

I tried various approaches: storing dotfiles in Dropbox, creating my own Git repository with symlinks, even writing custom shell scripts. Each solution had its own problems and maintenance overhead.

Enter Chezmoi: A Game Changer

Chezmoi is a dotfile manager that handles the complexity of managing configuration files across multiple machines. But it’s so much more than just a sync tool—it’s a complete configuration management system designed specifically for personal use.

What Makes Chezmoi Special?

  1. Template Support: Dynamic configurations based on machine-specific variables
  2. Encryption: Secure storage of sensitive data like API keys
  3. Cross-Platform: Works seamlessly on Linux, macOS, and Windows
  4. Git Integration: Built-in version control for your configurations
  5. Diff Management: See exactly what will change before applying

My Chezmoi Workflow

Here’s how Chezmoi transformed my daily workflow:

Initial Setup (One Time)

# Install chezmoi
sh -c "$(curl -fsLS chezmoi.io/get)"

# Initialize with your dotfiles repository
chezmoi init https://github.com/yourusername/dotfiles.git

# Apply the configuration
chezmoi apply

Daily Sync Script

I created two essential scripts that make managing configurations effortless:

sync-and-save.sh - My go-to script for keeping everything in sync:

#!/bin/bash

set -e

# Optional: Go to your chezmoi working directory
cd "$(chezmoi source-path)"

# Apply any changes (sync system with dotfiles)
echo "Applying chezmoi changes..."
chezmoi apply

# Git add/commit/push
echo "Syncing to git..."

# Optional: Check if anything changed
if [ -n "$(git status --porcelain)" ]; then
    git add .
    COMMIT_MSG="chore(dotfiles): update $(date +'%Y-%m-%d %H:%M:%S')"
    git commit -m "$COMMIT_MSG"
    git push
    echo "Changes pushed with commit: $COMMIT_MSG"
else
    echo "No changes to commit."
fi

save-dotfiles.sh - For quickly saving local changes:

#!/bin/bash

set -e

cd "$(chezmoi source-path)"

echo "Applying any staged local changes..."
chezmoi apply

echo "Saving to Git..."
if [ -n "$(git status --porcelain)" ]; then
  git add .
  git commit -m "chore(dotfiles): update $(date '+%Y-%m-%d %H:%M:%S')"
  git push origin main
  echo "✅ Dotfiles pushed."
else
  echo "📁 No changes to push."
fi

Real-World Impact

Before Chezmoi:

  • New machine setup: 4-6 hours
  • Configuration drift: Constant
  • Backup confidence: Low
  • Experimentation: Risky

After Chezmoi:

  • New machine setup: 15 minutes
  • Configuration consistency: 100%
  • Backup confidence: Complete
  • Experimentation: Fearless

Advanced Features I Love

1. Machine-Specific Configurations

Chezmoi templates allow me to have different configurations based on the machine:

# .chezmoi.toml.tmpl
{{- if eq .chezmoi.hostname "work-laptop" }}
[data]
    email = "work@company.com"
    git_signing_key = "work-key-id"
{{- else }}
[data]
    email = "personal@email.com"
    git_signing_key = "personal-key-id"
{{- end }}

2. Homebrew Brewfile Integration

One of the most powerful combinations is using Chezmoi with Homebrew’s Brewfile for complete package management. I manage my entire software stack through a Brewfile that Chezmoi tracks and applies automatically.

# Brewfile managed by chezmoi
tap "homebrew/bundle"
tap "homebrew/cask"

# Essential CLI tools
brew "chezmoi"
brew "git"
brew "neovim"
brew "tmux"
brew "fzf"
brew "ripgrep"
brew "bat"

# Development tools
brew "node"
brew "python"
brew "go"

# Applications
cask "visual-studio-code"
cask "docker"
cask "iterm2"

When setting up a new machine, Chezmoi can automatically run brew bundle install to restore my entire software environment. This means not only are my configurations synced, but all my tools are automatically installed too!

For a deep dive into mastering Homebrew and Brewfiles, check out my detailed guide on managing development environments with Homebrew.

3. Encrypted Secrets

Sensitive data stays secure but accessible:

# Store encrypted secrets
chezmoi add --encrypt ~/.ssh/config

# Templates can use encrypted data
{{- if hasKey . "github_token" }}
export GITHUB_TOKEN="{{ .github_token }}"
{{- end }}

4. Pre and Post Scripts

Automate additional setup tasks:

# run_onchange_install-packages.sh
#!/bin/bash
# This runs whenever the package list changes

{{ if eq .chezmoi.os "darwin" -}}
brew bundle install --file ~/.config/homebrew/Brewfile
{{ else if eq .chezmoi.os "linux" -}}
sudo apt update && sudo apt install -y bat fd-find ripgrep
{{ end -}}

The Workflow in Action

Here’s my typical day with Chezmoi:

  1. Morning: Pull latest configs with chezmoi update
  2. During work: Make configuration changes normally
  3. Evening: Run my sync script to save everything
  4. New machine: chezmoi init && chezmoi apply and I’m ready

Moving Between Computers is Now Effortless

The most significant change is how seamlessly I can switch between machines:

  • Cloud development: Spin up a new instance, run one command, and have my complete environment
  • Pair programming: Quickly set up my environment on a colleague’s machine
  • Conference demos: Never worry about having the wrong configuration in front of an audience
  • Disaster recovery: Complete environment restoration in minutes

Tips for Getting Started

  1. Start small: Begin with just your shell configuration
  2. Use templates: Take advantage of machine-specific customizations
  3. Automate everything: Create scripts for common operations
  4. Version everything: Your dotfiles are code—treat them as such
  5. Document your setup: Future you will thank present you

Conclusion

Chezmoi didn’t just solve my dotfile management problem—it transformed how I think about development environments. The confidence that comes from knowing my configurations are versioned, backed up, and instantly deployable has made me more productive and more willing to experiment.

If you’re still manually managing dotfiles or using a basic Git repository, I can’t recommend Chezmoi enough. The initial learning curve is minimal, but the productivity gains are substantial.

The next time you set up a new machine, instead of spending your weekend configuring everything, you could be coding within minutes. That’s the power of proper dotfile management with Chezmoi.


Ready to revolutionize your own workflow? Check out Chezmoi’s documentation and start your journey to configuration nirvana.

© Copyright 2025 Idlemind.dev. All rights reserved.