Sometimes you may run into issues with Homebrew on Macs. This article may help with some of them.
If you have a Mac with an M1 chip and you imported Homebrew formulae from a pre-M1 Mac,
your installation may be in the wrong place. This may result in errors such as not loading the proper libraries for the Platform.sh CLI or not being able to install in the ARM default prefix.
To determine if you have this problem, follow these steps:
- Determine your Mac’s architecture by running
- If the response is
arm64, you have an M1 chip and this section is relevant to you.
- Find where your Mac is looking for Homebrew by running
- If the response is
/usr/local/bin/brew, your Mac’s Homebrew is misconfigured.
To fix the problem, follow these steps:
- Create a list of your installed formulae by running the following command:
brew list --formulae >~/Downloads/formulae.txt.
- Unlink all of the formulae by running
brew unlink $(brew list --formulae).
- Remove your current Homebrew by running
sudo rm -r /usr/local/Homebrew.
- Reinstall Homebrew by running
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)".
- Use Homebrew to reinstall all of your formulae:
brew install $(cat ~/Downloads/formulae.txt)
Homebrew might not find some of your formulae. For example, your formulae.txt file may have an entry for
platformsh-cli. Change that
platformsh/tap/platformsh-cli, save the file, and repeat step 5. Repeat as necessary for all formulae that Homebrew can’t find. your installation may be in the wrong place.
After installing or updating the Platform.sh CLI via Homebrew, make sure you have the right
platform in your path by running the following command:
hash -r && ls -l $(which platform)
You should see a path that involves Homebrew:
/opt/homebrew/bin/platformon an Apple Silicon Mac (M1/M2)
/usr/local/bin/platformon an Intel Mac
If you don’t see that, delete the target that you see by running
sudo rm $(which platform) && hash -r. Then run
which platform and you should see the correct