Homebrew / install

📥 Homebrew (un)installer
https://brew.sh
BSD 2-Clause "Simplified" License
2.15k stars 1.02k forks source link

Update install.sh to allow repeated execution #865

Closed Konard closed 2 months ago

Konard commented 2 months ago

This change to the script does two things:

  1. It automatically gets user name
  2. It allows repeated execution (does not add a line to .zprofile twice, so it will not grow out of control)

It would be even better if install.sh will make it automatically without the need to execute these lines manually.

Support for repeated execution of the script is critical for CI/CD. It also makes user experience easy.

Workaround

As a workaround I have to create my own installation script:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
grep -qxF 'eval "$(/opt/homebrew/bin/brew shellenv)"' /Users/$(id -un)/.zprofile || (echo; echo 'eval "$(/opt/homebrew/bin/brew shellenv)"') >> /Users/$(id -un)/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"