Apple has released new hardware which utilizes an ARM64 based chip. This means a lot of software provided by Homebrew doesn't work. A couple of these include Rust and Go (which I will cover installing in another post). Thankfully both of these vendors have updated their software to work with the new chip from Apple. The downside is that Homebrew itself isn't even supported in the new M1 environment and it requries a little extra command-line work. I suspect this should be much of an issue for users of Homebrew though! This document assumes you already have Homebrew installed.
First bring up Terminal.app or whatever terminal application you use. I'm using Terminal.app since it's native so I know for sure I am building within and using a M1/ARM64 native application. Of note I personally create 2 accounts on every Mac. The first user is an administrator cleverly named
administrator, and then my second account is the account I use day to day and does not have administrator priviledges. So my first command on the command line is:
From there I run another command to edit the formula for Rust:
brew edit rust
Around line 37-38 I add
depends_on "ninja" => :build, so it's right after the line of
depends_on "pkg-config". This was done after reading this comment on GitHub. Now save and exit the file.
Run the following command to build and install Rust:
brew install -s --HEAD rust
It took about 30 minutes to build on my MacBook Pro M1.
% rustc -V rustc 1.50.0-nightly (2225ee1b6 2020-12-11) % cargo -V cargo 1.50.0