Switching from Mac to Ubuntu for Android Development

Nick Skelton

Late last year, I decided to swap my main development machine away from OSX and MacBook Pro to a custom-built PC with Ubuntu. The following is a narrative about why and how I decided to make the switch, my journey and some answers to some of the questions I had when I started out. I hope you find it useful and let me know if you decide to go down the same route!

Just a quick note: this is a subjective narrative, not a technical comparison. No benchmarking, no hard and fast numbers. Just a story. Grab a cuppa and kick your feet up, it’s entertainment.

My OS Background

Back in 2010, I received my first MacBook Pro when I joined a hip new startup. The first thing I did was use BootCamp to create a Windows partition and used the laptop as a Windows machine. I had only ever used Windows as an Operating System (OS) both professionally and personally. I was also a C# developer, so Windows made sense.

In 2011, I switched to the Mobile team and started working with Eclipse and XCode. Since XCode was (and still is) only supported on Mac (OSX), I decided to make the switch to Mac. I was already going to be learning two new languages and two new IDEs, might as well throw a new operating system to boot!

10 years later, OSX is still rocking my world. I have played with Windows here and there over the years, but quickly gone back to my cosy OSX home. I specialised in Android Development and so while I still dabble in iOS here and there, my professional life revolves around Android Studio. Android Studio, unlike XCode, supports Windows, OSX and Ubuntu. So unlike my iOS developer cousins — I’m not limited to a single operating system.

Android Studio is a heavy

In the past 3–4 years — Android Studio has grown into a truly amazing IDE (Integrated Development Environment). Combine that with advances in the Gradle build system and the success of Kotlin, Android development in general is looking more and more like .Net development, with a high level IDE that could rival Visual Studio (Microsoft’s flagship IDE since, like, forever). JetBrains has been heavily invested in Visual Studio for a very long time with products like Resharper.

But all these advances come at a cost — one that all Windows users are familiar with and we all joke about. Namely, resource usage. Long build/compilation times, high memory usage, strange behaviour that only “turning it on and off again” (aka Invalidate and Restart) seems to fix. It is a popular in-joke in the Android community to quip about ridiculously slow build times. But if you have ever worked on very large and very badly managed project, where clean build times can take 6–8 minutes, it’s no laughing matter.

Don’t skimp on your hardware

The last machine I bought was a MacBook Pro 15 Inch 2017 with 16Gb RAM (I actually bought it mid-2018) for 3300€. It is still a great machine, it still serves me well, but it wasn’t cheap, and lately, despite two completely fresh re-installations, it is struggling to do what I need it to do.

Now, as a consultant/freelancer, my laptop is easily the most important tool in my toolbelt. It is quite literally the source of my sustenance. It would make absolutely no sense to skimp on it — any extra money I spend on increasing its performance is going to have a significant return on investment (ROI) — a no brainer for any economist. In other words, buying a completely new machine every two years, to the average user, may seem over the top, but to me, it makes good good sense.

So I got to thinking — if I am willing to spend 3300€ every two years on new hardware, is Mac really the best way to go?

Pros and Cons of a new Mac

Here is what was going through my head when trying to decide.

Most of the work I do is remote, in my office, at my desk. Does it make sense to buy a desktop computer instead? Desktops are generally much more powerful than laptops and my MacBook Pro is still capable of doing the job whenever I have to go onsite. On the downside, an iMac Pro is upwards of 5000€. Which is considerably more than 3300€, but still ok considering my ROI rant above…

The new M1 is exciting, but is it going to live up to the hype for my use case — Android development? Or am I going to pay the double premium price (once for it being an Apple product and once for being an early adopter) and get a relatively smaller “bang for my buck” (relative to a desktop that is)?

With these doubts swirling around, I felt it was worth looking into a different route.

What does the alternative look like?

I started looking into what it would cost to build a machine myself. It had been over a decade since I had built a machine from its component parts, but things haven’t changed all that much. The parts are more or less the same there is just way more information and possibilities — in many ways it is much easier than it used to be. The biggest problem is what the Germans call “der Qual der Wahl” – the torture of choice.

I found a neat little website called pcpartpicker.com which is a bit like fantasy football for PC hobbyists. I started throwing together the biggest, badest beast of a machine I could imagine. Money is no object — just give me the best of everything!

What immediately piqued my interest was that, while I had no problems spending hours and hours reading reviews, calculating compatibility and watching nerdy YouTube clips about different parts and pitfalls, I struggled to spend 3000€ (without completely over-doing it, I mean one could spend 15000€ on a graphics card alone if one were so inclined).

Ok, so at first glance, buying hardware yourself and putting a machine together yourself will save a ton of money… in fact, just buying a machine that is not built by Apple is where the greatest savings are to be had. But it sounds like a lot of work right?

If researching and buying all the parts (CPU, motherboard, fans, case, hard drives, GPU) all sounds too daunting or boring to you, it is still very cheap to go to your local enthusiast (if you live in Germany mindfactory.de is a great example) and either pay them to do this work for you — or just buy one of their pre-made configurations. Building your own machine involves a decent investment of time — researching parts, checking compatibility, matching parts with Qualified Parts Lists from other parts… but it’s not rocket science. If you are a developer, you already have the skills to do this, it’s just a matter of whether you have the time, patience and interest.

Now people give Apple a lot of credit for making sure that their component parts all work together in an aesthetic and almost symbiotic fashion, and while it is true that they have got an amazing engineering team that does exactly this and that doing it is a profitable and successful business model … I personally don’t place as much value on it as the next person.

Having just built my own machine, without such an engineering team, I have no doubt made some sacrifices:

My computer is huge — the case is about the size and weight of a truck tyre and I won’t be transporting it anywhere without a couple of rugby players.

The compatibility of the parts is not professionally tested and tuned. There are no doubt some bottlenecks that I haven’t noticed, meaning that power consumption and performance could probably be improved with a slightly different combination of parts. Maybe my GPU RAM operates on a slightly different frequency to my RAM and the motherboards PCIe bus frequency is doing an extra conversion en route to where ever… In my head, I counter this by spending an extra few hundred €€€ on: a PSU that could provide Angus Youngs Marshall Stack with a clean, stable voltage long enough for him to shred through their back catalogue; a motherboard that could control the International Space Station; a hard drive that is faster than most RAM modules; enough RAM to hold my entire MP3 collection; a GPU built for rendering the Matrix (the one that we live in I mean — not the movie) and the very best and latest CPU money can buy.

In other words, instead of engineers, I threw money at the problem and it still came in well under 3000€. I don’t care about the portability, aesthetics or power consumption of my desktop computer — its plugged into the mains, sits under my desk and I don’t intend to move it. I just need it to hum (metaphorically of course — it runs in complete, eerie, futuristic silence).

Here is the final parts list I settled on if you are interested. Note that it’s just a list of parts, the prices and availability changes with the weather.

But now you can’t use OSX

A new machine, a non-Apple machine means no OSX. So am I going back to Windows? No way Jose. Ten years ago I made the leap into a new operating system, it’s high time to level up and start growing that neckbeard I always promised myself: Linux baby.

Which Linux distro to choose? Distrowatch.org is the :goto: for comparing the ecosystem out there, but again with the torture of choice. I had a play with Mint, it seems to be popular with Android Devs, but finally decided to go with Ubuntu because it is the recommended distro for Android Studio. When it starts to slow down or clog up (which every OS seems to do after a year or so) I figure I will be confident enough with Linux and have a long enough neckbeard to explore the next big distro and up my Linux street cred.

After pushing myself into Linux for a few months now, I can see where the extra money that you spend on OSX goes. “It just works” is what you pay for with Apple and it is money well spent. Still, there is something to be said for the experience of swapping operating systems — and the massive increase in performance of my development experience is making up for the time spent tweaking and customising. The projects that I am working on compiles two to three times faster… even in parallel. I have several projects open at the same time and can do parallel clean builds without a performance hit. That’s cool.

I’m still getting used to the different applications that I have to use for different tasks. SourceTree, for example, doesn’t exist for Linux, so I have learned to use Android Studio’s built-in Git management tools and have (finally) come to enjoy them.

The Verdict

While I take my hat off to Apple for removing the paper cuts from their OS, so far I don’t mind the paper cuts because my builds are lightning-fast and my IDE runs smooth as silk. I can develop more quickly and efficiently and that is what I do 90% of the time on my computer.

Sometimes I present at Meetups and conferences, and for this, I think I will stick to my MacBook. Apart from the obvious fact that a laptop is easier to travel with, there’s no substitute for “it just works” when you are standing in front of 100 people who are waiting for you to work out how to plug your laptop into the projector. Online presentations and screen casts are no exception. I don’t plan to build anything except small demo projects while in front of a large crowd so a small performance hit is ok in this situation.

My revised strategy is to buy a new machine every two years but to alternate between a desktop and a laptop. So in two years the MacBook Pro M1’s will for Android Studio, Gradle and JDK proven ready (ie. without emulation) and my MacBook Pro will be ready for retirement. It means I’ll have to maintain two computers: a laptop and a desktop, but well… luxury problems.

As for the beast I have just put together, I can’t see it breaking a sweat in the next four years and I’m still too deep in love with my lightning-fast development system to promise any objective insights. I’ll let you know once the honeymoon period is over…