Is Apple’s cheapest MacBook good enough for development?
I’ve been using an 8GB m1 MacBook Air for development recently, Apple’s cheapest laptop. But is it powerful enough?
Last week I’d concluded I needed an upgrade. My machine had started to freeze. Keystrokes sometimes took several seconds to be acknowledged. And I was getting the Spinning Beachball of Death far too often. As a result, my productivity was severely impacted and I was ready to spring for a shiny new MacBook Pro with 32GB of memory. Or maybe I need 64GB, it’s hard to tell. Either way, I was looking at a bill considerably north of £2,000 that I could ill afford.
But something was niggling at me. When I’d got this MacBook Air it had seemed so fast. Something didn’t seem right, so I thought I’d spend 1/2 hour working out what was really going on.
Here’s what my machine is typically running during the working day:
- Xcode for building my iPhone/iPad/Mac project
- Xcode simulator, for testing my app
- Docker, running Postgres and NodeJS servers for my app back-end
- VSCode, for editing the app back-end
- Zoom, for collaborating with colleagues and clients
- Slack, again for collaborating
- Safari, for finding answers on StackOverflow (!)
That’s actually a pretty decent workload for 8GB, so perhaps I shouldn’t be surprised that my machine was struggling. When I asked for advice, others were telling me I needed a minimum of 32GB. Time to warn my bank manager.
The first port of call for my pre-bank-manager-call investigation was to look at Docker — I suspected it was a bit of a resource hog. What I discovered straight away is that Docker has a set of preferences (under the Resources tab in Settings) where you set how much resource it has access to. And… I was allocating 8GB of memory — all my physical memory, just for Docker! I was also allowing it access to 4 CPUs. Now, Docker is only running Postgres and NodeJS servers that respond to the odd test transaction — 99.9% of the time they are idle. So, I set the memory to 2GB and restricted the CPUs to 2. That feels more appropriate and I genuinely couldn’t tell any difference in terms of the performance of my app back-end.
Next, I loaded up Activity Monitor and the first thing I noticed is a process named ‘electron’ that was using 99% of my cpu, even when I wasn’t doing anything. Of course, VSCode is an electron app and so I started googling around. It turns out this is a known issue, but with only obscure suggestions to downgrade VSCode. In the end I simply reinstalled the latest version of VSCode and that fixed it. I’m guessing something got screwed up through the auto-update process.
A bit more googling had me back in Docker. I ticked “Use the new Virtualisation framework” under Experimental features. Online consensus seems to be this is more efficient on m1 machines. Then, I selected “Enable VirtioFS accelerated directory sharing”. I benchmarked my app back-end starting up with and without these settings and it made a very noticeable improvement in startup time — definitely worth it.
For a laugh, after making these changes, I compared my machine with a colleague’s 2017 15 inch MacBook Pro. It was no contest — my little MacBook Air won hands down by an order of magnitude. It wasn’t even close — my app backed started up maybe 10x faster!
The result of all this? My machine is running like a dream. No freezes, no beachballs, no delayed keystrokes. Xcode, VSCode, Docker, Slack, Safari, Zoom (and more) all running nicely together.
Is an 8GB m1 MacBook Air sufficient for a developer? Yes, without a doubt. Before I made the changes I’ve described here, I was throwing all my physical memory at an app back-end that wasn’t doing anything and 100% of my CPU was being chewed up by an errant VSCode process. No wonder my little MacBook Air was struggling. A new machine, no matter how powerful, wasn’t my answer. Rolling up my sleeves and fixing my configuration issues was. 8GB is fine. I’d buy more next time given the choice, but don’t let anyone kid you otherwise — Apple’s cheapest Mac is perfectly adequate for app development. If you don’t have the money for a fancy machine, don’t let that hold you back. If you have the cash, by all means go crazy — but do it in the knowledge that it’s a choice, not a necessity. And if your friends try to tell you that you need 32GB as a minimum, get some new friends!