Skip to content

Commit 1050d5e

Browse files
committed
Invoke brew once during install
1 parent 5769367 commit 1050d5e

2 files changed

Lines changed: 8 additions & 4 deletions

File tree

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,10 @@ The following is the software that I have set as default:
294294
- watch
295295
- wget --enable-iri
296296

297+
The installer calls `brew --prefix` to detect your Homebrew prefix and appends
298+
`libexec/gnubin` directories for coreutils, gnu-sed, and grep to `.shellpaths`
299+
if they are not already present.
300+
297301
## Apps
298302

299303
- box-sync

install.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -203,13 +203,13 @@ brew doctor
203203
# Add GNU utilities to PATH once in .shellpaths
204204
shellpaths_file="./homedir/.shellpaths"
205205

206-
# Determine Homebrew prefix without invoking brew if possible
207-
if grep -qs "/opt/homebrew/bin" "$shellpaths_file"; then
206+
# Determine Homebrew prefix once using brew if available
207+
if command -v brew >/dev/null 2>&1; then
208+
brew_prefix="$(brew --prefix)"
209+
elif grep -qs "/opt/homebrew/bin" "$shellpaths_file"; then
208210
brew_prefix="/opt/homebrew"
209211
elif grep -qs "/usr/local/bin" "$shellpaths_file"; then
210212
brew_prefix="/usr/local"
211-
elif command -v brew >/dev/null 2>&1; then
212-
brew_prefix="$(brew --prefix)"
213213
else
214214
brew_prefix=""
215215
fi

0 commit comments

Comments
 (0)