Skip to main content
chemzoi is written in Go and development happens on GitHub. chezmoi is a standard Go project, using standard Go tooling. chezmoi requires Go 1.25 or later.

Quick Start

Checkout chezmoi:
git clone https://github.com/twpayne/chezmoi.git
cd chezmoi
Build chezmoi:
go build
Run chezmoi:
go tool chezmoi --version

Building with Make

chezmoi can be built with GNU make, assuming you have the Go toolchain installed. Running make will build a chezmoi binary in the current directory for the host OS and architecture. To embed version information in the binary and control installation the following variables are available:
VariableExamplePurpose
$VERSIONv2.0.0Set version
$COMMIT3895680aSet the git commit at which the code was built
$DATE2019-11-23T18:29:25ZThe time of the build
$BUILT_BYhomebrewThe packaging system performing the build
$PREFIX/usrInstallation prefix
$DESTDIRinstall-rootFake installation root
Running make install will install the chezmoi binary in ${DESTDIR}${PREFIX}/bin.

Build Targets

Default Build

Build for the current platform:
make build

Build from Git Working Copy

Build with embedded version information from git:
make build-in-git-working-copy
Install with embedded version information from git:
make install-from-git-working-copy

Cross-Compilation

Build for all supported platforms:
make build-all
Or build for specific platforms:
make build-darwin    # macOS (amd64 and arm64)
make build-freebsd   # FreeBSD (amd64)
make build-linux     # Linux (amd64)
make build-windows   # Windows (amd64)

Test Builds

Run a set of smoke tests, including cross-compilation, tests, and linting:
make smoke-test
Test building chezmoi for all architectures:
make test-release

Shell Configuration

If you use fish as your primary shell, you may get warnings from Fish during tests:
error: can not save history
warning-path: Unable to locate data directory derived from $HOME: '/home/user/.local/share/fish'.
warning-path: The error was 'Operation not supported'.
warning-path: Please set $HOME to a directory where you have write access.
These can be avoided by running tests with SHELL=bash or SHELL=zsh:
SHELL=bash make test
SHELL=zsh make smoke-test
SHELL=bash go test ./...

Build Dependencies

chezmoi has no build dependencies other than the standard Go toolchain.

See Also

  • Testing - Running the test suite
  • Packaging - Packaging guidelines for distributions

Build docs developers (and LLMs) love