Skip to content

chore(startup): auto-install tmux via Homebrew when missing - #453

Merged
sonichi merged 2 commits into
mainfrom
chore/startup-tmux-auto-install
Apr 19, 2026
Merged

sonichi merged 2 commits into
mainfrom
chore/startup-tmux-auto-install

Conversation

@sonichi

@sonichi sonichi commented Apr 19, 2026

Copy link
Copy Markdown
Owner

Summary

Per your "y" at 21:00Z in #dev: Sutando.app's watcher-auto-restart (PR #444) depends on a tmux-wrapped CLI pane to send watcher keystrokes when the task-watcher dies. If tmux is missing on a first-run machine, startup.sh falls back to a bare exec claude — functional, but silently drops the auto-restart feature.

Change

5-line guard in src/startup.sh:294: if tmux is missing AND Homebrew is available, install tmux before wrapping the CLI. Preserves the existing bare-exec fallback when both are absent.

  if ! command -v tmux > /dev/null 2>&1 && command -v brew > /dev/null 2>&1; then
    echo "tmux not found — installing via Homebrew (required for Sutando.app watcher-auto-restart)..."
    brew install tmux 2>&1 | tail -3
  fi

Test plan

  • bash -n src/startup.sh clean
  • Manual: on a machine without tmux + with Homebrew, bash src/startup.sh should auto-install then proceed to tmux wrap (no user prompt, no failed step)
  • Manual: existing-tmux machines should see zero behavior change

Scope

Doesn't touch the "neither tmux nor brew" path — that branch already has a helpful warning pointing at brew install tmux, just skipped now by the Homebrew short-circuit.

🤖 Generated with Claude Code

Sutando.app's watcher-auto-restart (PR #444) depends on a tmux-wrapped
CLI pane to send `watcher` keystrokes when the task-watcher dies. If
tmux is missing on a first-run machine, startup.sh falls back to a bare
`exec claude` — functional, but silently drops the auto-restart feature.

This adds a 5-line guard: if tmux is missing and Homebrew is available,
install tmux before wrapping the CLI. If brew is also missing, keep the
existing fallback behavior (warn + bare exec).

Tested: `bash -n src/startup.sh` clean. No behavioral change when tmux
is already present.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

@sonichi sonichi left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Small, isolated, backward compatible.

Logic verified:

  • Guard checks both command -v tmux missing AND command -v brew present → only auto-installs when Homebrew is available, respects existing assumptions.
  • brew install tmux 2>&1 | tail -3 truncates noise.
  • Subsequent if command -v tmux fallthrough still catches "install failed or brew absent" → bare exec claude with warning.
  • Preserves the intent of PR #444's auto-restart feature for first-run users without tmux.

Minor nit (not blocking): brew install tmux can take 30+ seconds on first run, and | tail -3 hides progress during that window. Consider printing a one-liner before the pipe if you want to signal "this may take a moment":

echo "tmux not found — installing via Homebrew (~30s)..."

(already close to what you have — just the "~30s" hint helps users not think it's hung). Totally optional.

No behavior change when tmux is already present. bash -n clean per Mini's PR body.

MacBook's review nit on PR #453: the brew install takes ~30s on
first run and `| tail -3` hides progress during that window. A
single word in the echo signals to the user that the pause is
expected.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@sonichi
sonichi merged commit 50eca14 into main Apr 19, 2026
1 check passed
@sonichi
sonichi deleted the chore/startup-tmux-auto-install branch April 19, 2026 14:10
sonichi added a commit that referenced this pull request Apr 19, 2026
MacBook's cold-review on #453 suggested signaling that `brew install tmux`
takes ~30s so first-run users don't think the script hung while tail -3
hides the brew progress output.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
liususan091219 pushed a commit to liususan091219/sutando-fork that referenced this pull request May 28, 2026
)

* chore(startup): auto-install tmux via Homebrew when missing

Sutando.app's watcher-auto-restart (PR sonichi#444) depends on a tmux-wrapped
CLI pane to send `watcher` keystrokes when the task-watcher dies. If
tmux is missing on a first-run machine, startup.sh falls back to a bare
`exec claude` — functional, but silently drops the auto-restart feature.

This adds a 5-line guard: if tmux is missing and Homebrew is available,
install tmux before wrapping the CLI. If brew is also missing, keep the
existing fallback behavior (warn + bare exec).

Tested: `bash -n src/startup.sh` clean. No behavioral change when tmux
is already present.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* chore(startup): add ~30s hint to tmux install echo

MacBook's review nit on PR sonichi#453: the brew install takes ~30s on
first run and `| tail -3` hides progress during that window. A
single word in the echo signals to the user that the pause is
expected.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Chi <wangchi@Chis-Mac-mini.local>
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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