Skip to content

feat: install brev CLI to ~/.local/bin without requiring sudo#344

Open
devin-ai-integration[bot] wants to merge 1 commit intomainfrom
devin/1774457394-install-without-sudo
Open

feat: install brev CLI to ~/.local/bin without requiring sudo#344
devin-ai-integration[bot] wants to merge 1 commit intomainfrom
devin/1774457394-install-without-sudo

Conversation

@devin-ai-integration
Copy link
Contributor

Summary

Changes the brev CLI install scripts to install the binary to ~/.local/bin instead of /usr/local/bin, removing the requirement for sudo during installation and upgrades.

Install scripts (bin/install-latest.sh, bin/install-latest-linux.sh):

  • Install target changed from /usr/local/bin/brev (via sudo) → ~/.local/bin/brev (no sudo)
  • Creates ~/.local/bin if it doesn't exist
  • Prints a PATH warning with copy-paste fix if ~/.local/bin is not in $PATH

Upgrade command (pkg/cmd/upgrade/):

  • Removed sudo.Gater dependency from the direct-install upgrade path
  • Replaced sudo gate with a simple confirmation prompt (matching the Homebrew upgrade UX)
  • Updated install path message to ~/.local/bin/brev

README: Removed sudo prefix from Linux and WSL install commands.

Review & Testing Checklist for Human

  • Upgrade path for existing users: If a user previously installed to /usr/local/bin/brev via sudo, running brev upgrade will now place the new binary in ~/.local/bin/brev — but the old binary in /usr/local/bin will likely shadow it on PATH. Consider whether the install script should detect and remove/warn about a stale /usr/local/bin/brev.
  • Shell-specific PATH guidance: The PATH warning only suggests appending to ~/.bashrc. Zsh users (default on macOS) would need ~/.zshrc instead. Verify this is acceptable for the Linux-only install script, or consider detecting $SHELL.
  • CI / root environments: Confirm that installing to $HOME/.local/bin is acceptable for automated/CI use cases where the old sudo-based install was used.
  • Manual test: Run bash -c "$(curl -fsSL .../install-latest.sh)" on a clean Linux environment and verify the binary lands in ~/.local/bin, the PATH warning appears if needed, and brev --version works after adding to PATH.

Notes

  • The sudo package and its usage in register/deregister commands (for netbird, systemctl) are intentionally left unchanged — those operations genuinely require elevated privileges.
  • Existing unit tests for the upgrade command all pass with the gater field removed.
  • golangci-lint could not run due to a pre-existing Go version mismatch in the environment (lint built with Go 1.23, project targets 1.24); this is not related to this change.

Link to Devin session: https://app.devin.ai/sessions/0d03f0bca5b54573b7dd0109a22afe65
Requested by: @theFong

- Changed install-latest.sh and install-latest-linux.sh to install to
  ~/.local/bin instead of /usr/local/bin, removing the need for sudo
- Added PATH warning if ~/.local/bin is not in the user's PATH
- Updated README install instructions to remove sudo prefix
- Removed sudo gating from the upgrade command's direct install path
- Updated upgrade message to reflect new install location

Co-Authored-By: Alec Fong <alecsanf@usc.edu>
@devin-ai-integration devin-ai-integration bot requested a review from a team as a code owner March 25, 2026 16:55
@devin-ai-integration
Copy link
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

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