Migrating Homebrew from an Intel to an Apple Silicon Mac

!
Warning: This post is over 365 days old. The information may be out of date.

These are the steps I took to migrate Homebrew from an Intel-based Mac to an Apple Silicon-based (abbreviated as ASi from here on out) Mac.

Preparations

Before moving, run the following command on your old Intel Mac:

brew bundle dump

This dumps the currently installed package list to a Brewfile in the current directory. Save it, or either leave it there if you’re doing a Mac-to-Mac transfer.

Wait, I don’t have my Intel Mac anymore!

Running the above command on an ASi Mac will fail, because that command requires git, and the Intel version of git will crash on ASi.

So after you finish with the ASi Homebrew install below, do the following:

# On Intel Homebrew terminal window
brew uninstall git

# On ASi Homebrew terminal window
brew install git

# On Intel Homebrew terminal window
brew bundle dump

Then proceed, starting with the “Uninstall Homebrew for Intel” section.

Install the ASi Homebrew

This step is rather simple. Just run the Homebrew install command again:

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

The installer will give you those two commands to run so that Homebrew is on your path:

(echo; echo 'eval "$(/opt/homebrew/bin/brew shellenv)"') >> /Users/ericswpark/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"

(Your command will have your username substituted in, obviously.)

Uninstall Homebrew for Intel

Run the following commands:

cd ~/Downloads

# Because wget (Intel version) might not run on ASi
curl https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh --output uninstall.sh

/bin/bash ./uninstall.sh -p /usr/local

The uninstaller didn’t have the necessary permissions to delete things fully, so I had to go into /usr/local and delete all files and folders in there after it had finished running. It should usually be safe to delete everything in that folder since macOS doesn’t even ship with it by default, but if you do have things that depend on stuff inside that folder, I suggest deleting carefully so that you don’t end up breaking something. In my case, I just decided to re-install whatever I broke, so I just deleted everything within that folder.

You may also need to delete any additions you made to your dotfiles so that the Intel version of Homebrew is in your path. In my case, I had to delete the lines in .zshrc referencing the previous Homebrew install in /usr/local.

Reinstalling everything

Open a new terminal window so that the ASi-version of Homebrew is active.

Navigate to the directory with the Brewfile from earlier and run:

brew bundle install --file ./Brewfile

Now you should be good to go!

Related Posts

comments