DEV Community

Cover image for Dotfiles Backup using `chezmoi` (MacOS)
Mainendra
Mainendra

Posted on

4 1

Dotfiles Backup using `chezmoi` (MacOS)

Install chezmoi

  • Brew
brew install chezmoi
Enter fullscreen mode Exit fullscreen mode
  • Curl
sh -c "$(curl -fsLS https://chezmoi.io/get)"
Enter fullscreen mode Exit fullscreen mode

Backup

  • (First time) Create a new repo - $ chezmoi init
  • (First time) Create a github (or gitlab, etc) - https://docs.github.com/en/get-started/quickstart/create-a-repo
  • Add / Update dot files - $ chezmoi add ~/.zshrc, $chezmoi add ~/.config/neovim, etc
  • CD into local repo - $ chezmoi cd
  • Commit your changes - $ git commit -am "Initial commit"
  • (First time) Add remote origin - $ git remote add origin git@github.com:username/dotfiles.git
  • Push your changes to remote repo - $ git push -u origin main

Restore

  • (First time) Clone remote repo - $ chezmoi init https://github.com/username/dotfiles.git
  • Pull and apply the latest changes - $ chezmoi update -v

Reference: https://www.chezmoi.io

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay