From 2cba393ae57d905b2cbb5b2bd53b2f6b90167500 Mon Sep 17 00:00:00 2001 From: arkon Date: Tue, 31 Mar 2026 19:34:39 +0200 Subject: [PATCH] fix: installer fails on macOS when piped via curl | bash When running `curl | bash`, stdin is the pipe, not the terminal. Homebrew and sudo need TTY access to prompt for the password. Redirect /dev/tty as stdin for these subprocesses. Co-Authored-By: Claude Opus 4.6 --- install.sh | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/install.sh b/install.sh index 2d7d6b8b..bb9103dc 100755 --- a/install.sh +++ b/install.sh @@ -353,8 +353,15 @@ ensure_sudo() { die "sudo is required but not installed. Please install packages manually or run as root." fi # Validate sudo access - if ! sudo -v 2>/dev/null; then - die "Failed to obtain sudo privileges." + # When piped (curl | bash), stdin is the pipe — redirect from /dev/tty so sudo can prompt + if [[ -e /dev/tty ]]; then + if ! sudo -v 2>/dev/null < /dev/tty; then + die "Failed to obtain sudo privileges." + fi + else + if ! sudo -v 2>/dev/null; then + die "Failed to obtain sudo privileges. Try running the script directly instead of piping." + fi fi } @@ -372,7 +379,12 @@ ensure_homebrew() { fi info "Installing Homebrew first..." - /bin/bash -c "$(download_to_stdout https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" + # When piped (curl | bash), stdin is the pipe — Homebrew needs TTY for sudo password prompt + if [[ -e /dev/tty ]]; then + /bin/bash -c "$(download_to_stdout https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" < /dev/tty + else + NONINTERACTIVE=1 /bin/bash -c "$(download_to_stdout https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" + fi # Add Homebrew to PATH for Apple Silicon if [[ -f /opt/homebrew/bin/brew ]]; then