If a Linux job hangs during Homebrew setup or brew install and eventually fails with Too long with no output (exceeded 10m0s), the job may be waiting for interactive input. CircleCI jobs run without a terminal, so any prompt that expects [y/n] will block until the no-output timeout.
Do you want to proceed with the installation? [y/n]
Homebrew is not pre-installed on Linux executors. You must install it before running brew install. That is a two-step flow: run the official install.sh script, then install packages. Each step can hang on a different prompt if not configured for non-interactive use.
If the hang is on apt or apt-get instead of Homebrew, the fix is different. See apt or apt-get hangs waiting for input on Linux executors.
Symptoms
- A step runs the Homebrew install script or
brew install. - The log lists formulas and dependencies, then stops at
[y/n]. - The step ends with
Too long with no output (exceeded 10m0s)orcontext deadline exceeded. - Later steps may fail if they depend on packages that were not installed.
Cause
Recent Homebrew versions use ask mode by default for some install operations. When a formula pulls in dependencies, Homebrew may ask for confirmation before proceeding. That prompt works locally in a terminal but blocks in CI.
Homebrew uses different settings depending on which step is running:
| Stage | What runs | Non-interactive setting |
|---|---|---|
| Install Homebrew | install.sh |
NONINTERACTIVE=1 |
| Install packages | brew install |
HOMEBREW_NO_ASK=1, brew install -y, or yes | brew install |
Setting NONINTERACTIVE=1 for the install script does not apply to later brew install commands in the same job.
Resolution
Step 1: Install Homebrew non-interactively
Use NONINTERACTIVE=1 when invoking the official install script:
- run:
name: Install and configure Homebrew
command: |
sudo apt-get install -y build-essential curl file git
NONINTERACTIVE=1 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
echo 'eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"' $BASH_ENV
source $BASH_ENVStep 2: Install packages non-interactively
Option 1: HOMEBREW_NO_ASK=1 (recommended at job level)
jobs:
build:
docker:
- image: cimg/base:current
environment:
HOMEBREW_NO_ASK: 1
steps:
- run:
name: Install dependencies
command: brew install <package>Option 2: brew install -y / --no-ask
- run:
name: Install dependencies
command: brew install -y <package>Option 3: Pipe yes
- run:
name: Install dependencies
command: yes | brew install <package>Combined example
- run:
name: Install Homebrew and packages
command: |
if ! command -v brew &/dev/null; then
sudo apt-get install -y build-essential curl file git
NONINTERACTIVE=1 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
echo 'eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"' $BASH_ENV
fi
source $BASH_ENV
export HOMEBREW_NO_ASK=1
brew install <package>Verification
Re-run the pipeline. The Homebrew steps should complete without stopping at [y/n], and later steps should find the installed packages.
Comments
Article is closed for comments.