Skip to content

docs: pass -b to the bootstrap so chezmoi lands on PATH - #19

Merged
natevick merged 1 commit into
mainfrom
docs/chezmoi-bootstrap-path
Aug 7, 2026
Merged

docs: pass -b to the bootstrap so chezmoi lands on PATH#19
natevick merged 1 commit into
mainfrom
docs/chezmoi-bootstrap-path

Conversation

@natevick

@natevick natevick commented Aug 7, 2026

Copy link
Copy Markdown
Owner

Follow-up to #18. Fixes the chezmoi: command not found seen after a fresh install.

The bug

The README's new-machine one-liner had no -b:

sh -c "$(curl -fsSL https://get.chezmoi.io)" -- init --apply natevick

The installer defaults to BINDIR="${BINDIR:-bin}"relative. So chezmoi lands in $PWD/bin/chezmoi, wherever you happened to run the command, and ~/.local/bin (what dot_zshenv puts on PATH) never gets it.

The failure is delayed and misleading: the installer ends with exec "${BINDIR}/${BINARY}" "${@}", so it runs the binary it just placed and init --apply succeeds. Everything looks fine until the next shell reports chezmoi: command not found.

install.sh already passed -b "$HOME/.local/bin" — only the README, the documented path for a new machine, was wrong.

Why not get.chezmoi.io/lb

The installer suggests it when -b .local/bin is passed, but it sets BINDIR="${BINDIR:-.local/bin}" — also relative, so it only lands correctly when run from $HOME. The explicit absolute -b "$HOME/.local/bin" matches install.sh and is cwd-independent.

Verification

Ran the corrected shape against a scratch dir:

$ sh -c "$(curl -fsSL https://get.chezmoi.io)" -- -b "$PWD/testbin" help
info installed .../testbin/chezmoi
Manage your dotfiles across multiple diverse machines, securely

-b honored and the trailing subcommand exec'd. Note --version is not a valid trailing arg there — it's consumed by getopts and prints usage; a subcommand like init stops option parsing cleanly, which is why the real command works.

Recovery on an already-broken machine

Just reinstall the binary to the right place — no need to re-run init:

sh -c "$(curl -fsSL https://get.chezmoi.io)" -- -b "$HOME/.local/bin"

🤖 Generated with Claude Code

https://claude.ai/code/session_01H2p4TH5SX7B3J8oAQaidc8

The installer defaults to BINDIR=bin, which is relative, so the README
one-liner put chezmoi in $PWD/bin/chezmoi — not on PATH. The failure is
delayed and confusing: the installer execs the binary it just placed, so
`init --apply` succeeds and the machine looks fine until the next shell
reports `chezmoi: command not found`.

install.sh already passed -b "$HOME/.local/bin"; the README, which is the
documented path for a new machine, did not.

Not using get.chezmoi.io/lb: it hardcodes a relative .local/bin, so it
only lands correctly when run from $HOME.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01H2p4TH5SX7B3J8oAQaidc8
@natevick
natevick merged commit 87965c3 into main Aug 7, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant