Everything works flawlessly after a brew install npm. Do yourself a favor and install a Chromium-based browser to check out Lighthouse. It’s been a while since I programmed in Go, but Dids created a gist entitled “Compile Go for Apple Silicon (M1)', where he explains how to compile Go natively. I have yet to try it out. Tldr; install brew; brew install python. Homebrew is a great installer for Mac and its main job is to make it easier to install packages. Step 1: Download Homebrew here 'brew' hosts its package information here as “formulae“. Step 2: Use brew to install the latest version of Python $ brew install python -verbose.
After reading all the raving reviews online about the new Apple M1-based Mac computers, and after losing too much time with my overheating MacBook Pro 2013 that’s on its last legs, I caved and bought a Mac Mini M1.
☑️ Apple 30″ Cinema display (2013)
I made the mistake of thinking that any USB hub with a Mini Displayport connector would work with my Cinema display. But apparently, not all such ports are also Thunderbolt 2, as I found out with my Satechi hub.. Fortunately, Apple sells a 55 euro Thunderbolt 3 (with USB-C connector) to Thunderbolt 2 (with mini Displayport connector), and it works perfectly. This already takes 1 of the 2 USB-C ports on the Mac Mini.
☑️ Homebrew in native mode
I do a lot of bash/script development so my first concern was getting all of my bash scripts working on the new ARM architecture. I concentrated on bash/terminal in native arm64 mode, which means not running under Rosetta2. This because I want to benchmark in native mode, and I kind of assume that under Rosetta 2 everything works that worked under MacOS for Intel, and where’s the fun in that?
For that, I needed to get the Homebrew package manager running in native mode. The thing is, Homebrew does not yet support the new Apple Silicon M1 chip (they only started the first steps in Dec 2020), so you have to dodge all the warnings they throw at you. After someresearch, I found the best way to do it, and I combined all of it in an easy install/uninstall bash script:** https://github.com/pforret/m1_homebrew** It installs the command-line tools and Homebrew to /opt/homebrew
for arm64 mode, and to /usr/local
for standard i386 mode.
Running it is as easy as:
🤞 brew install –build-from-source
After installation, running brew install
will give you warnings and will often not be able to install the packages, because there are no pre-built casks for Apple Silicon yet.
Still, you can tell brew to install from source code, and compile on your machine by using brew install --build-from-source
(or shorter: brew install -s
). For small packages like awk
, this will do the job. For large packages with lots of dependencies like ffmpeg
, brew will stop for lack of bottles.
☑️ native imagemagick
My first big package to install was imagemagick
. It’s my go-to tool for image manipulation and part of many of my scripts like e.g. splashmark. Imagemagick has lots of brew dependencies for treating different kinds of files, like libpng, openjpeg, webp and ghostscript. Every time brew requires a package that isn’t installed yet, it stops with the error mentioned above. You then have to build that package separately and try the original brew install
again. This is how I got imagemagick compiled in the end.
☑️ m1_homebrew recursive
I automated this process in the same script m1_homebrew.sh. m1_homebrew recursive imagemagick
first looks for all the dependent packages (via brew info
), installs those first one by one and then, at the end, installs the main package. It can take a long time but it’s magic when it works.
😥 no native ffmpeg
Unfortunately, it doesn’t always work. I tried it for ffmpeg
, but this package requires some dependencies that will not build on MacOS M1 for now. Concretely: rust
and openjdk
cannot be built yet, and ffmpeg requires them.
- rust: hangs on “
arch -x86_64 make
” which implies that it’s building a x86_64 (Intel) version instead of a arm64 native version, - openjdk: “configure: The tested number of bits in the target (64) differs from the number of bits expected to be found in the target (32)“
They are both still marked as ⚠️ on the official Homebrew M1 compatibility list.
Recent Posts
Generate individual tag/category/author pages for your Jekyll websiteI’ve been migrating more and more of my websites to Jekyll static sites, from Wordpress. The advantages are clear:
| My disaster upgrade to LastPass PremiumLastPass has started pushing its free users towards a paid premium subscription. The way they do this is by only allowing the free version for 1 platform, e.g. only your... • 18 Mar 2021 | Detecting excessive SSD wear on Apple Silicon M1 machines
|
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.
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 Chip
If, like me, you have multiple Macs with different CPU architectures, you can add something like this to your .bash_profile
or .zshrc
file: