Brew M1

broken image


I've seen three main ways that people are installing homebrew on their M1 Macs. The best method of install should be as smooth as possible while emulating intel architecture, and also should be as easy as possible to switch homebrew to native architecture when that is possible. The new Macs with M1 chip use the arm64 CPU architecture. Rosetta 2 is an emulator built into macOS Big Sur that allows ARM Macs to run the old intel applications. To install Homebrew on Mac M1, run the installation command with the arch -x8664 prefix. I recently purchased a MacBook Pro 13' with the M1 chip and transferred all my data over using a Time Machine backup. Homebrew packages are currently installed in /usr/local/opt/ but it is my understanding that they should be under /opt/homebrew for Apple Silicon Macs. Homebrew's package index. Can I brew in M1? There is also a REST endpoint at/api/can-i-brew that will give you the above response in JSON.

Instructions for a supported install of Homebrew are on the homepage.

This script installs Homebrew to its preferred prefix (/usr/localfor macOS Intel, /opt/homebrew for Apple Silicon) so thatyou don't need sudo when youbrew install. It is a careful script; it can be run even if you have stuffinstalled in /usr/local already. It tells you exactly what it will do beforeit does it too. You have to confirm everything it will do before it starts.

macOS Requirements

Brew M1 Chip

  • A 64-bit Intel CPU or Apple Silicon CPU 1
  • macOS Mojave (10.14) (or higher) 2
  • Command Line Tools (CLT) for Xcode: xcode-select --install,developer.apple.com/downloads orXcode3
  • A Bourne-compatible shell for installation (e.g. bash or zsh) 4

Git Remote Mirroring

You can set HOMEBREW_BREW_GIT_REMOTE and/or HOMEBREW_CORE_GIT_REMOTE in your shell environment to use geolocalized Git mirrors to speed up Homebrew's installation with this script and, after installation, brew update.

The default Git remote will be used if the corresponding environment variable is unset.

Alternative Installs

Homebrew

Linux or Windows 10 Subsystem for Linux

Check out the Homebrew on Linux installation documentation.

Untar anywhere

Just extract (or git clone) Homebrew wherever you want. Just avoid:

  • Directories with names that contain spaces. Homebrew itself can handle spaces, but many build scripts cannot.
  • /tmp subdirectories because Homebrew gets upset.
  • /sw and /opt/local because build scripts get confused when Homebrew is there instead of Fink or MacPorts, respectively.

However do yourself a favour and install to /usr/local on macOS Intel, /opt/homebrew on macOS ARM,and /home/linuxbrew/.linuxbrew on Linux. Some things maynot build when installed elsewhere. One of the reasons Homebrew justworks relative to the competition is because we recommend installinghere. Pick another prefix at your peril!

Brew m1 garand

Multiple installations

Create a Homebrew installation wherever you extract the tarball. Whichever brew command is called is where the packages will be installed. You can use this as you see fit, e.g. a system set of libs in /usr/local and tweaked formulae for development in ~/homebrew.

Uninstallation

Brew m1 mac install

Uninstallation is documented in the FAQ.

1 For 32-bit or PPC support seeTigerbrew.

2 10.14 or higher is recommended. 10.9–10.13 aresupported on a best-effort basis. For 10.4-10.6 seeTigerbrew.

Homebrew For M1

3 Most formulae require a compiler. A handfulrequire a full Xcode installation. You can install Xcode, the CLT, or both;Homebrew supports all three configurations. Downloading Xcode may require anApple Developer account on older versions of Mac OS X. Sign up for freehere.

Macbook M1 Brew

4 The one-liner installation method found onbrew.sh requires a Bourne-compatible shell (e.g. bash orzsh). Notably, fish, tcsh and csh will not work.

Let the great Homebrew migration begin. Yes, Homebrew now has native support for Apple's ARM64-based M1 chip. The latest version, 3.0.0, released 5 February, will run nicely on your Apple Silicon Mac. There's a catch, of course. Well, several catches: first, not all of the tools you can install using Homebrew are M1 native yet and, second, Homebrew doesn't offer explicit migration instructions, that I could find at least.

Brew M100

So I leapt in and hoped for the best. I've been using a mix of native Terminal (for tool usage) and Terminal under Rosetta 2 (for tool installation and upgrades), so anything that saves me from maintaining two Termini or temporarily switching the Open using Rosetta option in the utility's Get Info panel (and usually forgetting to switch it back afterwards) is a bonus. Here's what I did.

First, re-run the Homebrew installer. On an M1 Mac it will create a new installation under /opt/homebrew (on Intel it's under /usr/local/bin).

If you've been using Homebrew under emulation, you now have two side-by-side installs, so from this point on it's a matter of working tool by tool, installing an ARM64 versions then removing the x86-64 version. Tools that lack ARM64 versions can stay in the emulated world — just move on to the next one.

Edit your .bash_profile or .zshrc file to update any PATH additions or aliases to the new Homebrew installation. For example, alias nano=/opt/homebrew/nano instead of alias nano=/usr/local/bin and export PATH='/opt/homebrew/bin:$PATH' in place of export PATH='/usr/local/bin:$PATH'. But do read on for a solution that works with multiple Macs of different CPU architectures.

I didn't do this at this point, but were I to do all this again, I would add a further alias: alias oldbrew=/usr/local/bin/brew just to make accessing the old install a little more convenient.

I had side-by-side terminal tabs, one for brew … and the other for /usr/local/bin/brew … as I worked through my installed tools to check they install natively in the first tab and, if so, uninstalling the non-native version from the second tab.

I found that the majority of my previously installed tools have ARM64 versions, including some, like the Go language, which did not when I last checked, a few weeks ago. I can now build my websites with Hugo running on Go natively. Python 3.9 is M1 native, so that saves a lot of bother; I was able to rip out the non-native version entirely. Your mileage will vary according to which tools you use.

For example, I use shellcheck for linting Bash scripts, but it's not yet native and, as the Homebrew folk warn might be the case, can't be built from source, at least not using Homebrew. Fortunately, I don't use shellcheck regularly, so I can afford to wait for native support among all of its many dependencies. It still runs, of course, under Rosetta. I just need to try to re-install it using the native Homebrew every so often, or keep tabs on the Homebrew GitHub repo.

Once you've done, it's worth running brew cleanup to clear out any cruft from each install and then manually deleting any remaining orphaned files and links from /usr/local — look in the various sub-directories, including Caskroom, Cellar, Frameworks, Homebrew, and lib. If all of your Homebrew-installed tools are now native, you may not want to keep the old Homebrew install, and so the first four of these can probably be deleted.

Take care with the contents of /usr/local/bin — you may have tools there that were not installed by Homebrew, or were installed by Homebrew but with fixed install locations. For instance, my command line tools imageprep, pdfmaker and utitool continue to install into /usr/local/bin even when installed by M1-native Homebrew and even though they contain native ARM64 code.

Multiple Homebrews on multiple Macs

Brew m1 mac install

Linux or Windows 10 Subsystem for Linux

Check out the Homebrew on Linux installation documentation.

Untar anywhere

Just extract (or git clone) Homebrew wherever you want. Just avoid:

  • Directories with names that contain spaces. Homebrew itself can handle spaces, but many build scripts cannot.
  • /tmp subdirectories because Homebrew gets upset.
  • /sw and /opt/local because build scripts get confused when Homebrew is there instead of Fink or MacPorts, respectively.

However do yourself a favour and install to /usr/local on macOS Intel, /opt/homebrew on macOS ARM,and /home/linuxbrew/.linuxbrew on Linux. Some things maynot build when installed elsewhere. One of the reasons Homebrew justworks relative to the competition is because we recommend installinghere. Pick another prefix at your peril!

Multiple installations

Create a Homebrew installation wherever you extract the tarball. Whichever brew command is called is where the packages will be installed. You can use this as you see fit, e.g. a system set of libs in /usr/local and tweaked formulae for development in ~/homebrew.

Uninstallation

Uninstallation is documented in the FAQ.

1 For 32-bit or PPC support seeTigerbrew.

2 10.14 or higher is recommended. 10.9–10.13 aresupported on a best-effort basis. For 10.4-10.6 seeTigerbrew.

Homebrew For M1

3 Most formulae require a compiler. A handfulrequire a full Xcode installation. You can install Xcode, the CLT, or both;Homebrew supports all three configurations. Downloading Xcode may require anApple Developer account on older versions of Mac OS X. Sign up for freehere.

Macbook M1 Brew

4 The one-liner installation method found onbrew.sh requires a Bourne-compatible shell (e.g. bash orzsh). Notably, fish, tcsh and csh will not work.

Let the great Homebrew migration begin. Yes, Homebrew now has native support for Apple's ARM64-based M1 chip. The latest version, 3.0.0, released 5 February, will run nicely on your Apple Silicon Mac. There's a catch, of course. Well, several catches: first, not all of the tools you can install using Homebrew are M1 native yet and, second, Homebrew doesn't offer explicit migration instructions, that I could find at least.

Brew M100

So I leapt in and hoped for the best. I've been using a mix of native Terminal (for tool usage) and Terminal under Rosetta 2 (for tool installation and upgrades), so anything that saves me from maintaining two Termini or temporarily switching the Open using Rosetta option in the utility's Get Info panel (and usually forgetting to switch it back afterwards) is a bonus. Here's what I did.

First, re-run the Homebrew installer. On an M1 Mac it will create a new installation under /opt/homebrew (on Intel it's under /usr/local/bin).

If you've been using Homebrew under emulation, you now have two side-by-side installs, so from this point on it's a matter of working tool by tool, installing an ARM64 versions then removing the x86-64 version. Tools that lack ARM64 versions can stay in the emulated world — just move on to the next one.

Edit your .bash_profile or .zshrc file to update any PATH additions or aliases to the new Homebrew installation. For example, alias nano=/opt/homebrew/nano instead of alias nano=/usr/local/bin and export PATH='/opt/homebrew/bin:$PATH' in place of export PATH='/usr/local/bin:$PATH'. But do read on for a solution that works with multiple Macs of different CPU architectures.

I didn't do this at this point, but were I to do all this again, I would add a further alias: alias oldbrew=/usr/local/bin/brew just to make accessing the old install a little more convenient.

I had side-by-side terminal tabs, one for brew … and the other for /usr/local/bin/brew … as I worked through my installed tools to check they install natively in the first tab and, if so, uninstalling the non-native version from the second tab.

I found that the majority of my previously installed tools have ARM64 versions, including some, like the Go language, which did not when I last checked, a few weeks ago. I can now build my websites with Hugo running on Go natively. Python 3.9 is M1 native, so that saves a lot of bother; I was able to rip out the non-native version entirely. Your mileage will vary according to which tools you use.

For example, I use shellcheck for linting Bash scripts, but it's not yet native and, as the Homebrew folk warn might be the case, can't be built from source, at least not using Homebrew. Fortunately, I don't use shellcheck regularly, so I can afford to wait for native support among all of its many dependencies. It still runs, of course, under Rosetta. I just need to try to re-install it using the native Homebrew every so often, or keep tabs on the Homebrew GitHub repo.

Once you've done, it's worth running brew cleanup to clear out any cruft from each install and then manually deleting any remaining orphaned files and links from /usr/local — look in the various sub-directories, including Caskroom, Cellar, Frameworks, Homebrew, and lib. If all of your Homebrew-installed tools are now native, you may not want to keep the old Homebrew install, and so the first four of these can probably be deleted.

Take care with the contents of /usr/local/bin — you may have tools there that were not installed by Homebrew, or were installed by Homebrew but with fixed install locations. For instance, my command line tools imageprep, pdfmaker and utitool continue to install into /usr/local/bin even when installed by M1-native Homebrew and even though they contain native ARM64 code.

Multiple Homebrews on multiple Macs

If, like me, you have multiple Macs with different CPU architectures, you can add something like this to your .bash_profile or .zshrc file:

Sky go for non sky customers. Sky Go desktop app. The Sky Go desktop app makes it even easier for you to find the programmes you want to watch. And with Sky Mobile, you can watch Sky TV on the go without using your data. Sky Go is included at no extra cost to your Sky TV subscription. Got the Sky Go desktop app already? The Sky Go app is available for all Sky TV customers at no extra cost, so you can watch Sky on the go on your mobile, tablet or laptop. Skip to search skip to notifications.

See Also





broken image