Here I assume installing in macOS 15.5 would be similar to macOS 14.5. I don't have macOS 15.5 and do have macOS 14.5. When Homebrew finishing installing, I don't have any files in the /opt directory. Below are my results from installing.
According to https://brew.sh, the command to install Homebrew is as given below.
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
When installing Homebrew on macOS Sonoma 14.5, I get the following messages at the end of installation.
==> Installation successful!
==> Homebrew has enabled anonymous aggregate formulae and cask analytics.
Read the analytics documentation (and how to opt-out) here:
https://docs.brew.sh/Analytics
No analytics data has been sent yet (nor will any be during this install run).
==> Homebrew is run entirely by unpaid volunteers. Please consider donating:
https://github.com/Homebrew/brew#donations
==> Next steps:
- Run these commands in your terminal to add Homebrew to your PATH:
echo >> /Users/davidanderson/.zprofile
echo 'eval "$(/usr/local/bin/brew shellenv)"' >> /Users/davidanderson/.zprofile
eval "$(/usr/local/bin/brew shellenv)"
- Run brew help to get started
- Further documentation:
https://docs.brew.sh
I was able to run the following commands without any error messages.
echo >> /Users/davidanderson/.zprofile
echo 'eval "$(/usr/local/bin/brew shellenv)"' >> /Users/davidanderson/.zprofile
eval "$(/usr/local/bin/brew shellenv)"
BTW, the command echo "$(/usr/local/bin/brew shellenv)" produces the following output.
export HOMEBREW_PREFIX="/usr/local";
export HOMEBREW_CELLAR="/usr/local/Cellar";
export HOMEBREW_REPOSITORY="/usr/local/Homebrew";
fpath[1,0]="/usr/local/share/zsh/site-functions";
PATH="/usr/local/bin:/usr/local/sbin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin"; export PATH;
[ -z "${MANPATH-}" ] || export MANPATH=":${MANPATH#:}";
export INFOPATH="/usr/local/share/info:${INFOPATH:-}";