Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Common-Issues: Documents resolving dual installations from Migration Assistant copies #16668

Merged
merged 7 commits into from
Feb 19, 2024
37 changes: 37 additions & 0 deletions docs/Common-Issues.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,43 @@ xcode-select --install
brew upgrade
```

## Unintentional dual Homebrew installations

When using tools such as Apple's _Migration Assistant_ (MA), it's possible to have two Homebrew installations unintentionally.
This most commonly results in MA copying `/usr/local` and `/Applications` from an Intel-based Mac to these same paths on an Apple Silicon-based Mac.
This is problematic because `/Applications` may contain x86_64-only apps.
Using an x86_64 terminal emulator will cause the shell to use the `/usr/local` installation of Homebrew
instead of a new installation in `/opt/homebrew`, which is the correct path for an arm64 Homebrew installation on macOS.

Continuing with this setup may eventually cause problems, so it's best to migrate your Homebrew installation.
Follow these steps to do this.

1. Run `arch -x86_64 /usr/local/bin/brew bundle dump --global` to dump your current installed formulae list to `~/.Brewfile`.
1. Review the contents of `~/.Brewfile` to remove things you no longer want to have installed.
1. Verify that your terminal emulator is running in arm64 mode by checking that the output of `arch` is `arm64`.

* If it is not, use a different terminal emulator, such as Apple's Terminal.app, that will run in `arm64` mode.
colindean marked this conversation as resolved.
Show resolved Hide resolved

1. Reinstall Homebrew under the correct prefix (`/opt/homebrew`),
colindean marked this conversation as resolved.
Show resolved Hide resolved
which will happen by default when the terminal is running in arm64 mode.

* **Follow the _Next Steps_ instructions** listed at the end of the installation process;
colindean marked this conversation as resolved.
Show resolved Hide resolved
failing to adjust your shell configuration accordingly could break your Homebrew installation.

1. Run `/opt/homebrew/bin/brew bundle install --global` to replicate your original formulae installation using your new Homebrew installation in `/opt/homebrew`.

Note that if it's been a long time since you ran `brew upgrade`, you may encounter some package renaming that will require manual resolution.
Expect errors.
colindean marked this conversation as resolved.
Show resolved Hide resolved
Expect to spend some time [searching Homebrew's formulae and cask list](https://formulae.brew.sh/)
for replacements for deprecated, disabled, or removed formulae.

Once you are satisfied with the state of your new `/opt/homebrew` Homebrew installation, you can uninstall the old `/usr/local` installation with these next steps.

1. Download the uninstaller script: `curl -fsSL -o /tmp/uninstall.sh https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh`
1. Run `bash /tmp/uninstall.sh --path=/usr/local`
colindean marked this conversation as resolved.
Show resolved Hide resolved

For more information, see [this discussion](https://github.com/orgs/Homebrew/discussions/4397#discussioncomment-5567441).

## Homebrew Cask issues

### Cask - cURL error
Expand Down