Life on M1, part 1: mostly just works
New laptop! And angst
When thoughtbot gave me my choice work laptops (big Macbook Pro vs big Thinkpad), I chose “none of the above” and asked for one of the new M1 Macbook Pro 13” machines.
From one angle it was a no-brainer: “Please can I have a 13” M1 MBP? It’s cheaper, faster, and more environmentally friendly”.
From another, the risk-averse technologist in me feared that some things would not work on the new architecture. My internal argument was “there are things that don’t work currently, but lots of people will buy these machines so they probably will, at some point” against, “I have no idea of when that point will be, and I’ll have no way to influence it”.
I had been googling reviews since these machines came out so I did have some premonitions. Ruby developers trying out their development environments recommended some weird things to get all the tools running: install two copies of homebrew, one running natively, and another using Rosetta; or even maintain two separate terminals so that you can have everything running in rosetta in one terminal and everything running natively on another. The latter would wreak havoc with my tmux-based terminal-fu muscle memory.
Was I going to have to run Ruby non-natively and not get the benefit of my awesome CPU? Would I get random mysterious 2+2=5 errors?
I was emboldened by some slack words of a colleague: “I’m on an M1 13” MBP, everything works swimmingly” … “I didn’t do any of the arch shenanigans”. I had to try. It could be years before I got another machine (admittedly the 2014 13” MBP is still going strong), and I didn’t want to wait a long time to try that new new.
Mostly just works
The good news first: this machine has been really amazing. I have yet to hear the fan, not even with a few Emacs windows open and running my favourite Steam game at twice the resolution that I played it on my old machine (where it drained the battery in 30 minutes).
The battery life is far better than any previous laptop I’ve had (at any point in their lives): I’m writing at the end of a work day and I haven’t charged it yet today. That’s despite Emacs, video calls, running tests, hours of compiling Ruby from source, 20-40 safari tabs etc., all without any noticeable latency. I don’t think it’s going to reach the 10+ hours advertised, but it’s done enough.
Early commentary about using Rosetta for everything does not match my experience. I have yet to run a command using Rosetta (but stay tuned, there’s plenty else I had to do), and I think I now have everything I’ll ever need installed, including 5+ year old versions of things like MySQL.
Emacs nativecomp performance is unnecessary
I haven’t tried Emacs nativecomp (compilation of elisp plugins that makes the Emacs experience smooth). I skipped that one because the early Emacs M1 adopters said that normal, uncompiled experience is as fast as nativecomp on their non-M1 machines. My experience is the same.
New homebrew installation directory
The small configuration issues I had to deal with were mostly that homebrew running natively now installs everything to
/opt/homebrew. Some software (and my old dotfiles) still expected things in
/usr/local. This is technically a change in homebrew 2.6.0 rather than an architecture thing.
The catch: installing older versions of Ruby
There’s a part two coming that will say all of this in a lot more detail, but older Ruby versions (as far as I can tell, released before about October 2020) fail to build from source on M1 because they are packaged with build configuration that does not know about the arm64-apple architecture. By extension ruby-build and its clients (asdf and rbenv) are also broken (I’m not sure about RVM’s build process) for those versions.
Standard Ruby tooling wants dependencies to be installed with the exact same version as one uses to run the code. So it’s not enough to use Ruby (for example) 2.6.5 (released in April 2021), I have to run Ruby 2.6.3 (April 2019), if that’s what a client’s project requires. Or worse :(.
Next time on iftheshoefritz.com (spoilers!)
In part two of this tale, you can read about my hassles installing Ruby, in detail.
I did figure it out, eventually. If you want the spoilers, you can read about it in the issue I raised in asdf-ruby. The long version is a yarn of weeks of part-time debugging and learning about building Ruby from source. Coming next week!
subscribe via RSS