Relationships
#3817 swamp update suggests sudo for a binary in ~/.local/bin, and following it breaks every later update
Opened by kagarmoe · 10/23/2026
Description
When swamp update can't write its binary, it tells you to use sudo, even when the binary lives in the user's home directory (~/.local/bin/swamp). Following that advice leaves a root-owned binary in a user-owned directory, and every later non-sudo swamp update fails the same way. So the hint causes the problem it then reports.
Observed on macOS (Apple Silicon), updating 20261022.200604.0 → 20261022.211048.0:
Error: Cannot update /Users/[REDACTED]/.local/bin/swamp: permission denied. Re-run with: sudo swamp updateState at the time:
~/.local/bin/swampwasroot:wheel, left by an earliersudo swamp update.~/.local/binitself was owned by the user.
Steps to reproduce
- Install swamp to
~/.local/bin/swampas a normal user. - Run
sudo swamp updateonce. The binary is now root-owned. - After the next release, run
swamp updateas the user → the permission-denied error and sudo hint above.
(I couldn't force a fresh repro today because swamp update has no option to reinstall the current version.)
Workaround
Because the directory is user-writable, a rename works without sudo:
cd ~/.local/bin && cp swamp swamp.new && mv -f swamp.new swampExpected
- Replace by rename:
swamp updateshould write the new binary next to the old one andrename()it into place. That needs write access to the directory, not the file, so it works here, and it's also atomic. - Better hint: when the binary is under
$HOME, don't suggest sudo. Explain that the binary is owned by another user and how to fix the ownership. - Warn under sudo: consider warning when
swamp updateruns as root on a binary in a non-root user's home.
Environment
swamp 20261022.200604.0 → 20261022.211048.0, macOS 27
In Progress
Click a lifecycle step above to view its details.
Sign in to post a ripple.