trycua/cua

cua-driver installer: print the PATH export command when ~/.local/bin isn't on PATH

Open

#3,004 opened on Aug 9, 2026

 (1 comment) (0 reactions) (0 assignees)HTML (1,051 forks)batch import
enhancementgood first issue

Repository metrics

Stars
 (16,722 stars)
PR merge metrics
 (Avg merge 1d 9h) (119 merged PRs in 30d)

Description

Summary

When the installer finishes and the install dir (~/.local/bin by default) is not on PATH, the post-install output never prints the copy-pasteable command to add it. The user is left with a working binary they can't invoke, and no instruction to recover.

I hit this on a fresh macOS install: cua-driver 0.19.2 was installed correctly, the symlink was in place, but which cua-driver returned nothing and nothing in the install output told me how to fix it.

Repro / evidence

$ which cua-driver
cua-driver not found

$ ls -la ~/.local/bin/
lrwxr-xr-x  1 administrator  staff  53  cua-driver -> /Applications/CuaDriver.app/Contents/MacOS/cua-driver

$ /Applications/CuaDriver.app/Contents/MacOS/cua-driver --version
cua-driver 0.19.2          # binary is fine

$ case ":$PATH:" in *":$HOME/.local/bin:"*) echo YES;; *) echo NO;; esac
NO

~/.zshrc existed but contained no PATH line, and ~/.zprofile / ~/.zshenv / ~/.profile didn't exist at all — so ~/.local/bin was never going to be picked up.

Where the gap is

libs/cua-driver/scripts/_install-rust.sh:1064-1080:

# Auto-extend PATH for users whose shell doesn't already include BIN_DIR.
if [[ "$NO_MODIFY_PATH" != "1" ]] && [[ ":$PATH:" != *":$BIN_DIR:"* ]]; then
    SHELL_RC=""
    case "${SHELL:-}" in
        */zsh)  SHELL_RC="$HOME/.zshrc"  ;;
        */bash) SHELL_RC="$HOME/.bashrc" ;;
    esac
    if [[ -n "$SHELL_RC" ]]; then
        ...
        log "appended PATH update to $SHELL_RC — open a new shell or run \`source $SHELL_RC\`"
    else
        log "WARNING: $BIN_DIR is not on PATH; add it manually."
    fi
fi

Three ways a user ends up with no actionable command:

  1. --no-modify-path / CUA_DRIVER_NO_MODIFY_PATH=1 prints nothing at all. The whole block is gated on NO_MODIFY_PATH != 1. Opting out of the rc edit shouldn't also opt you out of being told what to do — that's exactly the user who most needs the line.
  2. The else branch says "add it manually" without saying what to add. Any shell that isn't zsh/bash (fish, nushell, ksh) or an unset/odd $SHELL (piped installs, CI, sh -c, provisioning scripts) lands here.
  3. The success path only names the rc file, never the line itself. If the append doesn't take effect — rc not sourced for login shells, a .zprofile-driven setup, dotfile manager later overwriting .zshrc — there's nothing to copy. This is likely what happened to me.

Requested change

Whenever BIN_DIR is not on PATH, always print the explicit command, independent of NO_MODIFY_PATH and independent of whether shell detection succeeded. Something like:

warning: /Users/you/.local/bin is not on your PATH.

  Add it with:
    echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zshrc && source ~/.zshrc

  Or run the binary by full path:
    /Users/you/.local/bin/cua-driver --version

Suggested shape:

  • Compute the hint once and print it in all branches — appended, not-appended, and opted-out. When the rc edit did happen, still show the line so the user can verify or re-apply it.
  • Emit correct syntax per shell, falling back to POSIX when $SHELL is unknown:
    • zsh/bash → export PATH="$BIN_DIR:$PATH"
    • fish → fish_add_path $BIN_DIR
    • nushell → $env.PATH = ($env.PATH | prepend "…")
  • Make it visually prominent — this is the difference between a working install and an apparently broken one, so it deserves more than a log line buried above the cua-driver X installed. banner.

Consistency across the other installers

The comment at _install-rust.sh:1096-1101 notes that post-install hints live in a shared post-install-hints.txt so the four Rust installers don't drift. The PATH hint is currently not part of that shared text, and the same gap exists in the siblings:

  • libs/cua-driver/scripts/install.ps1-NoPathUpdate
  • libs/cua-driver/scripts/install-local.ps1-NoPathUpdate ("skip the auto-append of the bin dir to the User PATH")
  • libs/cua-driver/scripts/_install-local-rust.sh — has no BIN_DIR-not-on-PATH check at all

Worth fixing in one pass so all four behave the same. The Windows ones need the setx / $env:Path equivalent, and a note that an already-open terminal won't see a User PATH change until restarted.

Environment

  • macOS (Darwin 25.6.0), Apple Silicon, zsh
  • cua-driver 0.19.2
  • Default BIN_DIR (~/.local/bin)

Contributor guide