Skip to main content
← Back to list
01Issue
BugShippedSwamp CLIPublic
Assigneesstack72

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 update

State at the time:

  • ~/.local/bin/swamp was root:wheel, left by an earlier sudo swamp update.
  • ~/.local/bin itself was owned by the user.

Steps to reproduce

  1. Install swamp to ~/.local/bin/swamp as a normal user.
  2. Run sudo swamp update once. The binary is now root-owned.
  3. After the next release, run swamp update as 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 swamp

Expected

  • Replace by rename: swamp update should write the new binary next to the old one and rename() 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 update runs as root on a binary in a non-root user's home.

Environment

swamp 20261022.200604.0 → 20261022.211048.0, macOS 27

02Bog Flow
✓OPEN✓TRIAGED✓IN PROGRESS✓SHIPPED+ 1 MOREASSIGNED+ 5 MOREREVIEW+ 9 MOREPR_LINKED+ 2 MORESESSION_SUMMARIZED

Shipped

10/23/2026, 12:40:28 PM

Click a lifecycle step above to view its details.

03Sludge Pulse
stack72 assigned stack7210/23/2026, 11:53:56 AM
Editable. Press Enter to edit.

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.