After 11 years I have decided to leave the Apple ecosystem for doing development work and move to a dedicated Linux environment.
Back in 2009, I leapt from Windows to Mac after being disgusted with the availability of development tools on Windows as it pertains to open source development. I was the first to do so in the company and was an Apple devotee ever since, owning a half dozen Macbook Pros in that time.
So why change?
I see many devs proclaiming how great WSL2 is on Windows because you can install Linux and "its just like being in Linux!". I mean, if what you need to use to do your job works best in a nix environment - by all means, be in that environment. Our work is hard enough, the last thing you need are obstacles between yourself and getting work done.
I started to find I was asking myself the same question about MacOS.
The Docker and Mac Saga
Anyone who works with Docker and uses a Mac will know exactly what I am talking about. The performance issue of running Docker on Mac is well documented and exists in numerous threads, issues and blog articles. It seems that neither Apple nor Docker are particularly interested or invested in addressing this problem.
Without additional methods of improvement, whether that be using :cached or :delegated, or NFS mounts, none of that really seemed to do much for me on MacOS. Running tests, using Composer or NPM, or running Drush commands (all of these from the command line) take a considerable amount of time longer than they should.
Over the course of a day, this lost time compounds and totals up to missed opportunity for productivity. Multiply that across every developer and you are dealing with a lot of lost billable time, the potential for increased velocity of work, and the most noticeable effect - reduced morale. Developers love to move fast.
But I thought you said...
In an earlier blog post, it looked like Docker was working on something out of the box for Mac - but that was removed in a later release. Back to square one.
The closest I have come to resolving this for our Mac developers is leveraging the beta release of Mutagen and including instructions in the docker-compose file for Macs on taking advantage of it. This helps and can improve performance to a degree, but is cumbersome to have to go get a separate tool. Effectively, Mutagen acts a sidecar and mounts your volumes within it so (I assume) there is reduced cross-talk between Linux and the host OS (Mac).
I have a custom Docker stack for our projects, and it knows how to take advantage of Mutagen if it is present and its all more or less hidden away from the end user, but it just screams to me "maybe you should just be on Linux".
Some have relented and wound up installing Linux in a VirtualBox VM. This results in you ssh'ing in and, well, basically working in Linux. This is how I used to do it before switching to Docker, using Jeff Geerlings excellent "DrupalVM" project. I chose not to go back down this path for a few reasons though:
- You still pay a penalty in resources or performance from having a VM.
- Multiple VMs (one per project) start to add up on your disk space.
- It is one more thing for every developer to have to deal with, producing more cognitive load than they care to consider.
- Stability and the process of provisioning VMs seems to vary across Windows and Mac - and I need to support multiple team members with a smooth experience.
I have our Docker stack ironed out now so that you can be on Windows (WSL2 only) or Mac and run the projects just fine. We can onboard anyone in the world in less than ten minutes and get straight to work in a uniform, consistent way. But I have other considerations at this point.
A laptop does not make sense for me
Both Macbook Pros I currently have are the 2014 model. This means that I know this means they would need replacing either this year or next, whenever Apple decides that the next OS won't support it. I have put off updating prior to now because I enjoy having ports, I don't want a Touchbar, and the butterfly keyboard was a massive failure. These changes are not additive in my opinion nor add new value, which is why I have put off updating.
The price point is also unappealing and cost prohibitive to me. Take the Macbook Pro for example. The 16" model starts at $2400 for the Intel i7 CPU, or $2800 for the current gen i9. I want 32GB of ram too, so that is an additional $400 on top. That puts the price north of $3000 all told, after tax and opting into Apple Care. Apple would love for you to just ignore that fact and buy new ones every few years (seeing as how parts are soldered now). While it is true I can make them pay for themselves rather quickly, its an absurd waste of money.
Plus, in the working remotely / Covid era, I am not mobile at all. Why do I need a laptop? Pretty much all year both have been docked upright on my desk, hooked to an external monitor. Its not like ye olde days where I will take them and go work in the lounge, conference room or coffee shop. I do not know when those days will return either.
Apple M1 is not for me (right now)
The new M1 chip, if all reviews are to be believed, is said to be a stellar performer. I'm sure it is. This still does not change the fact that many open source tools and libraries will have to compile to be compatible for this CPU, and it does not resolve the issue with Docker. At best, it can only hide those issues - they will still be present. As a stop-gap some software is able to run under Rosetta 2, a translation layer that lets execution happen on the new system. But why pay the high price to run software in what is essentially emulation? I wouldn't be getting the benefits of it.
I can't afford the downtime either waiting for compatibility. Will it be months? A year? Conservative estimates put say, Docker, around the second half of 2021 at the earliest. But that does not account for the myriad of Docker images out there or any of the other software I use, some of which has no timeline.
I am usually fine being an early adopter, but I don't think risking that on going from x86 to ARM is a good idea particularly when I need max productivity. You can still buy Intel based Macs for a time, but, why buy tech Apple is clearly shifting away from?
What option is there, then?
Last fall I started wondering what direction I could go in. What brand do I look at, what do I buy? Do I have to go back to a desktop tower? What price range am I looking at?
Fortunately, I came across some key blog articles that told me I was on the right track. This one in particular was very helpful. It reminded me that small form factor computers existed and might be able to do what I am looking for. Specifically, he calls out that Intel themselves manufacture their own (NUCs), and so the search began.
There are a wide variety of NUC models out there. There are the general NUCs, and there are the Canyon series NUCs. The Canyon series NUCs have a little more horsepower to them and often times a 2GB GPU card. I was interested in this point because I have a 4K 27" monitor that would likely put some pressure on a software rendering to power. I wasn't willing to take a chance without that, so I settled on selecting one.
I found the model to be the one that would suit my needs best without breaking the bank. They retail around $1200, the total price may be a little higher depending on the side of the solid state drive or amount of RAM (and brand) you select to put inside it.
This is a much better price up against what Apple is asking for. Yet still, I wanted to be pragmatic about it. What if I get into this, and don't like it? What dollar figure would be okay to walk away from if I had to get my Macbook Pro back out?
I decided to take some chances and scout eBay for a deal. If for some reason it just doesn't work out for me, I can always list it back at the price I got one for. I have done that in the past with music equipment. So I set off to eBay with a few search parameters and started waiting.
I reviewed and watched eBay for nearly three months looking at various NUCs in that series and their bidding prices. I decided to look for actual owners that were selling, I did not want to get one from a computer reseller. Finally, I found the perfect listing - the exact model I was looking for, and it had 16GB of RAM and a 256GB SSD to boot. No extra parts needed.
I bided my time until the last seconds of the auction and entered my price - $650, half of what I would pay for a new one.
This Intel NUC is one bad ass little unit. It has a 3.10 Ghz Intel 8th gen i7 CPU, comes with all the ports I could ever need, and it can power my monitor and display in 4K @ 60hz (my Macbook Pro models are on older HDMI spec, so, they cannot). The quality is unbelievable.
I opted to just run with Ubuntu 20.04 LTS for now so I can get started with the transition. I am familiar enough having worked around Ubuntu and Debian for a number of years. It took about 20 minutes or so to install from a USB SD card caddy, and about an hour to setup various settings for me in Ubuntu.
After that, all that was left was to install Docker and add my ssh key and I was ready to work. Since our projects have been in Docker for some time now, they "just worked". PHPStorm installed and synced my settings from the cloud, as did Google Chrome.
This, effectively, accounts for a huge majority of my day to day tools.
All told, I was up and running in about 3 hours, which I found to be excellent. I was even able to track down a GitHub repo providing a driver for the Apple Magic Mouse 2, so I can continue to use that. My KeyChron K6 mechanical keyboard works fine as well. I've already made commits to various projects and working like I normally would.
The performance of Docker makes the switch all the more worth it. I can do all the things I need to do in the course of normal project work without losing as much time as I was before waiting for Mac and Docker to complete a task. It is in this area where this unit will pay for itself.
Not all grass is greener though
There are a couple of issues that are annoying that I have to work around. They aren't show stoppers, just trivial issues that are par for the course under Linux:
- Unloading/reloading the Magic Mouse 2 driver to get scrolling to work is a little ridiculous. I understand though, that the mouse has proprietary drivers otherwise. I wrote a login script to fix this behavior so I don't have to.
- Using the Magic Mouse, it was harder than I expected to universally disable middle click to paste. Gnome Tweaks claims it can do this, but that only works for GTK based apps apparently. I added "xmodmap -e "pointer = 1 25 3 4 5 6 7 8 9 10"" in that same script above to disable it entirely. It is too easy to accidentally paste with the Magic Mouse.
- The resolution is super high! Setting fractional scaling and 150% zoom makes things readable, but this causes a static mouse cursor to be stuck on the screen. You have to set it, unset it, then set it back to get it to go away. This is a known bug in Ubuntu 20.
- Clicking an icon in the taskbar will sometimes bring up the current instance of an app (Chrome, Terminal, etc) or sometimes just create a new instance of it entirely. I stopped using the taskbar and dock and started using the window manager. I haven't found a fix for this yet.
That's about it. I can't really complain otherwise for only investing $650. Especially since I found out that the SSD is not 256 GB, it is actually 500 GB storage! I have a lot of room to work with.
Really, take a look at the NUC.
This little unit should work for me for the next 3-5 years. Not a bad investment. If I have to switch machines in the future, the downtime is less than 6 hours. The only thing I missed from Mac is the excellent Alfred app. I replaced that with its Linux variant, Albert.
If this interested you, I would implore you to consider what NUCs are out there for use. It might make more sense than dropping thousands on another Mac without really advancing much or being able to change the memory or SSD yourself.
For those who may be unwilling to let go of MacOS - I get it. It is indeed a very polished UI/UX. You might want to check out Elementary OS to ease into switching. I would bet though that after a few days to a week, you won't really miss MacOS. I thought I would, and I do not.
Mac Mini M2? M3?
In a few years when the M chip has been iterated on and the software I need catches up, perhaps I will revisit if the Mac Mini as an option. It would be a perfectly capable machine.
As it stands, I am done paying thousands for their laptops for development needs.