Published on

Re-installing Homebrew on Macbook Pro Silicon 2021

Last Modified on
Last modified on
Authors
Re-installing Homebrew on Macbook Pro Silicon 2021
Photo by Kristian Hunt on Unsplash

Recently I had updated my MacBook Pro Late 2015 to Monterey 12.6, and it wreaked havoc on my MacBook Pro. Not that things were so fantastic to begin with (it is almost 8 years old after all), but updating to 12.6 drained down my battery very quickly and ate up my memory. And the laptop started getting very hot again as a result. a year ago, right before my Apple Care expired, the battery swelled, screwed up the indexing so that it thought I had no more space on my internal Hard Drive, so I had to very quickly get the battery replaced. I went to the iStore, an Apple partner, and had the work done there. Well, it barely lasted me a year. Barely. And the job was really subpar. Never going back there again. When they first opened, it was another set of guys, and they were GREAT. But by 2021, it was a completely different management and/or ownership. At least in the NYC store.

I knew I had to get over to the Apple Store at Grand Central and get a new laptop ASAP, before things got precarious. And I did! I got a MacBook Pro 16 inch, 2021, with an Apple M1 Max chip, 64GB of RAM (a dream!), and 4TB internal HD. However, when I migrated things from my Intel Mac over to the Silicon M1 Max Chip, I had to do some reconfiguration!

One thing which was critical to me I had to re-install, because it is installed into a new path in MacBook Pros on Monterey with the M1/M1 Max Chip on Silicon. At first I thought it was going to be a major deal. That I would have to install each Homebrew package individually, and that it would take a long time to complete. But I found out that that is NOT the case!

I did some research on how to migrate my Homebrew configuration on my old MacBook Pro Intel, and came across an article which provided the command for re-installing Homebrew on my new Mac, fixing the path to the new /opt/homebrew/bin/brew path (instead of /usr/local/bin/brew as it was previously installed on my MacBook Pro Intel).

First I had to re-install Homebrew. In addition, I could not uninstall my previous install that was migrated from my Intel MacBook Pro. macOS (naturally) could not find it. I re-installed Homebrew with the following command:

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

Next, after the install completed, I got something like the following back in Terminal:

==> Next steps:
- Run these two commands in your terminal to add Homebrew to your PATH:
    echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> /Users/mariacam/.zshrc
    eval "$(/opt/homebrew/bin/brew shellenv)"
- Run brew help to get started
- Further documentation:
    https://docs.brew.sh

First I ran the command:

echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> /Users/mariacam/.zshrc

And then I ran the command

eval "$(/opt/homebrew/bin/brew shellenv)"

And this set up my Homebrew install in /opt/homebrew/bin.

But then I had to make sure to install all those packages I depended on in my Intel MacBook Pro. This same article explained how I could do it in one fell swoop!

Next, I had to create a list of the Homebrew packages I had installed on my Intel MacBook Pro. So there, I created a Brewfile that listed all the packages I had installed with Homebrew by running the following command in Terminal:

brew bundle install --file ~/desktop/Homebrew/Brewfile

You have to make sure to run the command in the directory you want the file to appear in. I created a Homebrew folder and then I ran the above command. The folder was for the sake of ease of file sharing from the old MacBook Pro to the new one. brew bundle install lists all the Homebrew packages I had installed on the old laptop and printed them to the Brewfile that was _**created*** within the Homebrew folder on my desktop.

Next, I had to make sure that I could transfer over the Brewfile from my Intel MacBook Pro to my new Silicon MacBook Pro. So I first went into File Sharing on my Intel Mac, and selected the Homebrew folder there located on my desktop and then selected myself as the user for sharing access to that folder.

Then I went into my Silicon Mac into File Sharing where I selected my public folder, and the Homebrew folder appeared on my Silicon Mac desktop. And then all I needed to do was to run the brew bundle install --file ~/desktop/Homebrew/Brewfile command on my Silicon Mac. And all the packages were installed immediately. I had to remove one that would not install, and that initially resulted in a failed attempt to install all the packages. But after I removed it (it was highlighted in red as well), I was able to successfully install all the other packages.

This definitely made re-installing Homebrew on my new MacBook Pro with a completely different chip from my previous MacBook Pro very easy! I highly recommend reading the article I came across entitled Using Homebrew on M1 Mac, as it goes into the background and reasons for all these Homebrew changes on the new MacBook Pro with the M1 Max Chip and on macOS Monterey.

There is still a lot more to do, but this definitely was an excellent start. Especially since I got my latest version of Git back (version 2.37.3), among other things!