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· Shipped 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
Shipped
Click a lifecycle step above to view its details.
stack72 commented 10/23/2026, 12:42:09 PM
@kagarmoe thanks for such a clear report, including the diagnosis and the rename workaround. It made this an easy fix.
swamp update no longer refuses when it can't write the binary itself. It now checks that it can write to the folder the binary is in, because the update replaces the binary by moving a new file into place. A root-owned ~/.local/bin/swamp therefore updates without sudo, and the new binary belongs to you again.
The permission message no longer suggests sudo for a folder in your home directory. It suggests sudo swamp update only for root-owned system folders like /usr/local/bin. Elsewhere it tells you how to fix the folder's permissions (chmod u+w or sudo chown). If you run sudo swamp update on a binary in a folder you own, it now warns you that sudo wasn't needed.
It's in the next release, from swamp-club/swamp#3325.
Sign in to post a ripple.