3

I am following the official Homebrew installation guide correctly and running:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

According to the guide:

This script installs Homebrew to its preferred prefix (/usr/local for macOS Intel, /opt/homebrew for Apple Silicon and /home/linuxbrew/.linuxbrew for Linux) so that you don’t need sudo when you brew install. It is a careful script; it can be run even if you have stuff installed in the preferred prefix already. It tells you exactly what it will do before it does it too. You have to confirm everything it will do before it starts.

I am running on Monterey:

enter image description here

However, this is not the case for me, as it is disregarding the fact that I am running Apple Silicon M1 chip and is trying to install Homebrew into the Intel prefix! Terminal output:

~ % /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
==> Checking for `sudo` access (which may request your password)...
Password:
==> This script will install:
/usr/local/bin/brew
/usr/local/share/doc/homebrew
/usr/local/share/man/man1/brew.1
/usr/local/share/zsh/site-functions/_brew
/usr/local/etc/bash_completion.d/brew
/usr/local/Homebrew
==> The following new directories will be created:
/usr/local/bin
/usr/local/etc
/usr/local/include
/usr/local/lib
/usr/local/sbin
/usr/local/share
/usr/local/var
/usr/local/opt
/usr/local/share/zsh
/usr/local/share/zsh/site-functions
/usr/local/var/homebrew
/usr/local/var/homebrew/linked
/usr/local/Cellar
/usr/local/Caskroom
/usr/local/Frameworks

Press RETURN to continue or any other key to abort:

Why does the installer not attempt or prompt me to install Homebrew into the /opt/homebrew/ folder? What must I do? Every guide and question I can find online seems to suggest that it should do this automatically anyway. Grateful for any help!

0

3 Answers 3

8

I just ran into this. Go into your applications, right mouse click your terminal app, click "Get Info", and uncheck the "Open using Rosetta" option.

enter image description here

Then fully close your terminal, open it again, and reinstall.

2
  • 1
    This was already unchecked for me, but the installer still wants to install into /usr/local. Any other ideas?
    – oKtosiTe
    Commented Aug 16, 2022 at 13:54
  • @oKtosiTe I know this has been a while but you may need to change your user's shell using chsh, which I've just described in more detail in another answer. Commented Dec 21, 2023 at 3:26
3

Another possibility is that the shell you're using is an Intel version installed with the old version of Homebrew, e.g. /usr/local/bin/bash. Switch to /bin/bash and reinstall.

1

For those who are still getting the intel locations after switching the shell setting in Terminal.app, it may be because you changed your user's shell at some point the old fashioned way using chsh. (or by right-clicking on a user in Settings->Users&Groups). If that's the case, you can simply set it back to /bin/bash (or any shell that came with macOS like the abominable zsh) using chsh as well, which luckily is still part of macOS.

You can check what your user's shell is using finger <username>, which surprisingly is also still there. And you can check what architecture shell you are in inside an active shell session by running

uname -p

or

uname -m

If this says i386 (-p) or x86_64 (-m), you are inside an intel shell. If it says arm (-p) or arm64 (-m), you're in an Apple Silicon one.

Anyway, the fix here is

chsh -s /bin/bash <your_username>

It will prompt you for your password, then change the shell. Log into a new shell and you should now be inside an arm64 shell. You can verify this with uname as described above.

Hope this helps a few people.

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .