Developing on Apple Silicon
Switching from x86 to arm64 as a web developer.
By James Xu on November 12, 2021
I recently upgraded from a 2018 13" MacBook Pro to the newly-released 14" MacBook with the M1 Pro. Out of the box, I was impressed with the thermal efficiency and performance of the chip compared to the 8th-gen Intel chip in my previous laptop. Programs opened that much faster, and I couldn't get the fans to spin up no matter what I threw at it.
Unfortunately, compatibility issues popped up right from the get-go.
Node should work...right?
To give my new machine a spin, I decided to clone a small website (this one), to see what the web development experience
would be like. I installed Homebrew and jumped right in with brew install node@16
to get Node.js up and running. I was
impressed with how easy it was to install arm64
versions of my tooling as Homebrew pretty much managed it all for me.
The problems began when some of my website dependencies relied on node-gyp
and compiled native modules. Of major note
was node-sass
, which did not have arm64
binaries for Mac.
I probably spent hours trying to debug this and find workarounds, but I ended up just compiling my SCSS to avoid the issue entirely. Other than this, the experience with Node.js was fine, and I appreciated the better performance. Another solution would have been to run everything under Rosetta 2, which would've most likely worked at a cost to performance.
Virtualization
I am taking a class on computer systems which is heavy on C programming. Students are issued Duke-owned Docker containers to develop on through the VSCode remote extension. I usually prefer to be able to develop locally so that I can work in poor network conditions and use an editor other than VSCode.
The Docker containers we were given were x86 and in many assignments we needed to read the compiled assembly, so an x86 virtualization environment was critical. Docker for M1 is in preview right now, but it only supports arm64 Linux containers. Most of the macOS virtualization applications (Parallels, VMWare Fusion, VirtualBox) only supported arm64 VMs, so I wasn't able to go that route. It seems Rosetta 2 does not support virtualization, so my only option would have been through emulation with QEMU.
At this point, I decided it was easier to stick with the provided remote Docker containers rather than setting up my own development environment.
Other software
I was happy that most software that I use have native Apple Silicon versions (Firefox, VSCode, IntelliJ, Zoom, Slack). The majority of Intel apps run great under Rosetta 2 and I honestly needed to check Activity Monitor to confirm that they weren't fully native. This is true even for gaming, though I don't play a lot of graphically demanding ones. Unfortunately, Electron + Rosetta 2 is a terrible combination, with Discord giving the poorest experience. There is noticeable lag with almost all UI interactions and the feature gap between the desktop and web versions are too big for me to use the browser version. Until Discord releases a native Apple Silicon version, I don't have any choice other than to bear the slowness.
Summary
Developing on an Apple Silicon device is a great experience when things work. Unfortunately, when things don't you are often left with little recourse. I certainly wish that I evaluated my needs more in-depth before purchasing, and I recommend that for any potential switchers as well.