Ask HN: How are you dealing with the M1/ARM migration?
But the migration to ARM is proving to be quite a pain point. Not being able to just do things as I would on x86-64 is damaging my productivity and creating a necessity for horrible workarounds.
As far as I know none of our pipelines yet do multi-arch Docker builds, so everything we have is heavily x86-64 oriented. VirtualBox is out of the picture because it doesn't support ARM. That means other tools that rely on it are also out of the picture, like Molecule. My colleague wrote a sort of wrapper script that uses Multipass instead but Multipass can't do x86-on-ARM emulation.
I've been using Lima to create virtual machines which works quite well because it can do multiple architectures. I haven't tested it on Linux though, and since it claims to be geared towards macOS that worries me. We are a company using a mix of MacBooks and Linux machines so we need a tool that will work for everyone.
The virtualisation situation on MacBooks in general isn't great. I think Apple introduced Virtualization.framework to try and improve things but the performance is actually worse than QEMU. You can try enabling it in the Docker Desktop experimental options and you'll notice it gets more sluggish. Then there's just other annoyances, like having to run a VM in the background for Docker all the time because 'real' Docker is not possible on macOS. Sometimes I'll have three or more VMs going and everything except my browser is paying that virtualisation penalty.
Ugh. Again, I love the performance and battery life, but the fragmentation this has created is a nightmare.
How is your experience so far? Any tips/tricks?
283 comments
[ 5.3 ms ] story [ 41.9 ms ] threadFor developers using VMs, Docker, multi-pass, etc I think it is more trouble than it is worth to jump on to the new shiny thing and invest time in workarounds that break on a new update. At least you weren't part of the November 2020 launch day chaos otherwise you would be waiting 6 months to do any work if you went all in on the M1.
Looks like Intel is (still) the way to go for VMs until Apple Silicon gets better (eventually).
[0] https://news.ycombinator.com/item?id=26159495
Also, the post you linked is over a year old and the situation has changed since.
If you aren't ready to switch to ARM, consider Linux.
Yes. Exactly. It tells us that had the OP jumped all in to Apple Silicon since the day it launched, then they would have been waiting months to do their work. Little of the software from Intel was actually working in November 2020.
Thus, the sensible and smart action to do was wait and stick to Intel. By the time the software ecosystem caught up to Apple Silicon, the M2 Macbooks were announced meaning that they can upgrade directly to M2, skipping the M1 altogether with more working software than on release day.
For web development, I believe that Apple Silicon is really the place to be right now (especially if you also work on design projects!)
But apart from that it’s been incredibly smooth.
This will also download the Intel versions of all the providers when terraform executes. Which reduces the problems a ton since there are some providers that are definitely not aarch64, especially when it comes to older versions.
For actually creating multi-arch, I recommend you stay as far away as possible from Docker and use Podman and Buildah. The latter unbundles some of the Docker manifest commands, giving you far more control over how you create multi-arch images. I wasted 4 months on Docker tooling, and got it right in half a week with Podman. This meant switching from DCT (Podman doesn't support this at all) to Cosign, but Cosign is far more sensible than DCT.
There are a rare few containers that you can get away with running on x86.
For my 9-5 employer, biggest drawback we've come across is that SQL Server can't be installed on Windows 11 ARM, which is preventing us from having a truly local development environment.
We've gotten everything else working via Azure SQL Edge running via Docker for Mac, but it lacks several features that we require (e.g. full-text search, spatial data types).
Despite a recent announcement (https://blogs.windows.com/windowsdeveloper/2022/05/24/create...) that Visual Studio will soon support ARM, There are no signs that SQL Server 2022 will support ARM.
My employer is still moving forward with provisioning M1 MBPs for developers.
Running x64 and ARM together on one machine will work through tricks like Rosetta but I don't believe that stuff will ever work well in virtual machines, not until Apple open sources Rosetta anyway.
I'd take a good, hard look at your tech stack and find out what's actually blocking ARM builds. Linux runs on ARM fine, so I'm surprised to hear people have so many issues.
What you could try for running Docker is running your virtual machines on ARM and using the native qemu-static infrastructure Linux has supported for years to get (less efficient than Rosetta) x64 translation for parts of your build process that really need it. QEMU is more than just a virtualisation system, it also allows executing ELF files from other instruction sets if you set it up right. Such a setup has been very useful for me when I needed to run some RPi ARM binaries on my x64 machine and I'm sure it'll work just as well in reverse.
I like how ARM is progressing (I owned a second-batch RPi!), and M1 would probably be right for me if I wasn't a technical user, but it's simply too exhausting to fight the machine, architecture, package manager and product all at the same time. Docker is (and has been for a while) loathsome on Mac. Virtualization is usually pretty bad too, which makes regression-testing/experimentation much slower. I might give it another go if Asahi figures out GPU acceleration, but I'm not very hopeful regardless. The M series of CPUs doesn't really make sense to me as a dev machine unless you have a significant stake in the Apple ecosystem as a developer. Otherwise, it's a lovely little machine that I have next to no use-cases for.
> Any tips/tricks?
Here's one (slightly controversial) tip: next time you're setting up a new Mac, ditch Homebrew and use Nix. This is really only feasible if you've got a spacious boot drive (Nix stores routinely grow to be 70-80gb in size), but the return is a top-notch developer environment. The ARM uptake on Nix is still hit-or-miss, but a lot of my package management woes are solved instantly with it. It's got a great package repository, fantastic reproducability, hermetic builds and even ephemeral dev environments. The workflow is lovely, and it lets me mostly ignore all of the Mac-isms of MacOS.
Then tried again early this year with a M1Max MBP, and it has been the biggest step change productivity boost of my life. Definitely still some pain points, but the way this thing handles anything I throw at it is incredible.
I'm mostly doing front-end dev (react native). Have a minimum of 2 IDEs, 1 iOS simulator, 1 Android simulator, Windows (ARM) Virtualbox, 2 browsers open at all times. And then add a mix of Docker, XCode, Android Studio, Zoom, Sketch, Affinity apps, Slack, Zoom, etc. I haven't ever heard the fan spin up. I was carefully managing what I had open on the 2018 MBP, and now I don't even think about it.
The only thing I'm still running in Rosetta is Apple software: XCode and the iOS simulator, but they run smooth, so I don't even think about it.
The MBA setup I was just flailing my way through. For the M1Max setup, I found this guide very helpful in my initial setup (mostly focused on a RN Dev): https://amanhimself.dev/blog/setup-macbook-m1/
But is anyone else surprised how long it's taking to get the iOS Simulator for ARM? I feel like it would make a massive difference to my developer experience (especially in battery). And I haven't seen any indication that it's coming anytime soon.
I open up my 13.3 beta 2 and go to the xcode tab go down to open developer tool click on simulator and then click on file and then open simulator my mouse over to iOS 15.4 go down to the iPhone 13 for example click on it and then I have a simulated iPhone 13...
And if I check the activity monitor nothing in my activity monitor is showing up as Intel code except for parsec right now...
And your comment made me go look back at my react native project setup. Looks like the main reason my app is still building to x86 is because of one Expo dependency that doesn't yet compile to arm64. So more of a Expo concern.
Thanks for checking on your end.
How old is your version of xcode? From what I can see they added M1 support 1.5 years ago.
Android? Android Studio has problems? That would be vital to me if i went Mx.
My 2nd try with the MBP in 2022, following the guide I linked above, Android Studio has been perfect.
You can run molecule against an ec2 instance or Docker containers. Since you can run x86_64 docker containers on Docker for Mac, you can continue to use molecule. I run molecule tests against Docker containers or LXD in the cloud though just because of how much faster they run on large Ec2 instances.
As for everything else, I haven't really noticed many issues. Most of the work I do is built through CI/CD pipelines so what I use locally to build doesn't affect what is deployed to production.
Maybe people here haven't lived through 68K to PPC migrations, or to DEC Alpha, or Sun SPARC to Intel, or PPC to Intel, or any number of platforms and platform shifts - some lasted longer than others, but all had their ups and downs. The largest 'down' was predatory business practices in the 80s and 90s, which set computing back a decade (and still apparently continues today). It's unfortunate that many of these FUD-type articles pop up whenever a new platform/chip is announced. I'm excited for technological progress and think that every new announcement is another small miracle that I'm happy to be around for.
Happy to be corrected if I am wrong.
https://developer.apple.com/documentation/virtualization/run...
https://developers.apple.com/videos/play/wwdc2022/10002/
If you are not familiar, Rosetta is how Apple Silicon Macs run existing Mac x86 binaries and it is highly performant. It does binary pre-compilation and cacheing. It also works with JIT systems. They are now making that available within Linux VMs running on Macs.
https://threedots.ovh/blog/2022/06/quick-look-at-rosetta-on-...
Hopefully, this is the right timestamp:
https://developer.apple.com/videos/play/wwdc2022/10002/?time...
Last thing I read, 70% of the native performance was shown by running GeekBench through Rosetta (with a few odd results noted).
If somebody has better info...
Edit: I see that Nov 2020 checks returned an 80% performance, and there was discussion on HN at (at least) https://news.ycombinator.com/item?id=25105597
ARM Geekbench single core on M1 MacOS is 1734. ARM Geekbench single core on WinARM in VM on M1 is 1550. x86 single core on i9 MB Pro MacOS is 1138. x86 in emulation on M1 MacOS is 1254.
Yes, 72% x86 Rosetta vs. M1 Native. However, x86 Rosetta on M1 was faster than the previous i9 2019 Macbook Pro x86 native. I consider that to be performant for running code that was compiled for a very different architecture.
Anyway I can say that my colleagues M1 using rosetta is faster or equal to my MBP i9 2020.
Benchmarks are good for bragging rights and maybe convincing over-zealous accounting to approve a purchase (but even then that’s probably not all there is to it.)
And how do people without disposable income judge?
You can decide beforehand if increased speed with respect to your experience on your machines is beneficial to you or not.
When benchmarking x86 and ARM containers, our application seems to be around ~5x slower with x86-rosetta, and similarly can be observed for mysql-server or just doing `apt install`.
This is still significantly better than using qemu emulation, but it's not really usable in our case.
I've also encountered segmentation faults when running x86 `npm` inside Docker, so couldn't even install packages, but didn't dig further as to what's the cause.
(Note: I've created a simple macOS app using Virtualization framework, enabled Rosetta, and loaded Ubuntu Focal. I've installed the latest version of Docker, which automatically used `rosetta` when encountering x86 executables. Maybe this setup is not ideal.)
Much more impressively it also leverages a custom hardware x86-like memory model unique to the M1/Apple ARM chips. That's where most of the performance really comes from, as I understand it.
The only problems we've had is slow performance of Docker for us with our databases. So much so, we've moved those out of Docker and back to the native. Performance is easily 6x faster. MySQL was also a headache because finding a MySQL 5.7 official Docker container didn't exist for ARM so we needed to use the slow emulation through qemu.
We also have a CLI dev tool that is written in Python and distributed in Docker (x86) which has also been slow. Not enough time to build ARM based Docker image.
Regarding slowness - i'm curious, how that's the problem - from my understanding on local dev env datasets are small and even 6x times slower (say what is 1 ms on production be 6 ms on your machine) shouldn't be any issue? Can you provide some examples? (I may need to run DB locally for tests one day, getting prepared)
My solution was to give up using my M1 mac for development work. It sits on a desk as my email and music machine, and I moved all my dev work to an x86 Linux laptop. I'll probably drift back to my mac if the tools I need start to properly support Apple Silicon without hacky workarounds, but until GitHub actions supports it and people start doing official releases through that mechanism, I'm kinda stuck.
It is interesting how much impact GitHub has had by not having Apple Silicon support. Just look at the ticket for this issue to see the surprisingly long list of projects that are affected. (See: https://github.com/actions/virtual-environments/issues/2187)
Putting on my tin-foil hat for a sec: GitHub is owned by Microsoft, who would really stand to benefit from slowing down Apple Silicon adoption a bit...
The rest of us is still running on racks of Mac Minis
https://devblogs.microsoft.com/devops/cloud-hosted-mac-agent...
> Please be aware that during this preview, our Mac hardware is hosted in third party datacenters in the United States and your build and release data could cross geopolitical lines. After each build completes, its macOS VM is reimaged, leaving no trace of your data on the agent. For more information, see where VSTS data is stored. Our Mac datacenters will expand to other geographies soon
>Agents that run macOS images are provisioned on Mac pros with a 3 core CPU, 14 GB of RAM, and 14 GB of SSD disk space. These agents always run in the US irrespective of the location of your Azure DevOps organization.
And Apple's EULA makes them basically unusable as short term rented servers, there's a minimum of 24h which is ridiculous.
”(ii) each lease period must be for a minimum period of twenty-four (24) consecutive hours;
(iii) during the lease period, the End User Lessee must have sole and exclusive use and control of the Apple Software and the Apple-branded hardware ”
https://www.apple.com/legal/sla/docs/macOSMonterey.pdf (Section 3.)
But a lot of projects have tests they want to run on their target platforms.
If you build your Linux release on Windows, you might accidentally release a .zip where your binaries aren't executable. If you set up cross-compiling to Mac 5 years ago and tested it then, perhaps in the meantime code signing has become mandatory. If you build and test on Linux and release to Windows, perhaps you'll get tripped up by filenames becoming case-insensitive.
Some projects are keen on testing on all target platforms to flush out issues like that.
That wouldn’t be too much of an issue if you could just cross compile like you can with go. However graalvm can’t do this yet.
In nutshell I don't see how having Apple Silicon locally makes the problem - if your non local env (dev, prod, stage) is running on x86 Linux or even arm Linux, shouldn't be any issue to build for that architectures on your build farms anyway.
I may be missing some important part here.
I work on scientific software, so the biggest technical issue I face day-to-day is that OpenMP based threading seems almost fundamentally incompatible with M1.
https://developer.apple.com/forums/thread/674456
The summary of the issue is that OpenMP threaded code typically assumes that a) processors are symmetric and b) there isn't a penalty for threads yielding.
On M1 / macOS, what happens is that during the first OpenMP for loop, the performance cores finish much faster, their threads yield, and then they are forever scheduled on the efficiency cores which is doubly bad since they're not as fast and now have too many threads trying to run on them. As far as I can tell (from the linked thread and similar) there is not an API for pinning threads to a certain core type.
GOMP_CPU_AFFINITY=“1 2 5 6”
With thread 1 bound to core 1, thread 2 on core 2, thread 3 on core 5, thread 4 on core 6. I don’t have an M1 to play around on but I’d have assumed that the cores are fixed IDs.
Aside from that, if the workload is predictable in time, using a more complex scheduling pattern might help. You could perhaps look at how METIS partitions the workload, but see if it’s modifiable by adding weights to the cores reflective of their relative performance. Generally, to get good OMP performance I always found it better to treat it almost like it’s not shared memory, because on HPC clusters, you have NUMA anyway which drags performance down once you have more threads than a single processor has cores in the machine
I agree with your other points though!
2. Everything you install will be arm based. Docker will pull arm-based images locally. Most every project (that we use) now has arm support via docker manifests.
3. Use binfmt to cross-compile x86 images within prlctl, or have CI auto-build images on x86 machines.
That pretty much does it.
We were using UTM but have recently switched to Parallels, which is nice.
Our prod stayed on x86 but we’ve started moving to graviton3 which is better bang for buck. Suspect it’ll end up being a common story for others too.
m1s are just such nice machines that I’d go quite out of my way to stay on them now.
https://news.ycombinator.com/item?id=31094361&p=2#31101729
https://news.ycombinator.com/item?id=31094361#31098721
https://news.ycombinator.com/item?id=27825240#27825420