I love my new M1 Macbook Air. No fan but awesome performance. Working keyboard. And the feature of not having a touch bar is not only included but it’s the cheaper option — I would have paid money for that!
I had two requirements for developing that I wanted to achieve: macOS UI, Linux-based dev environment. I was a bit weary about the new architecture and frankly I expected not to be able to work efficiently on it for a while. I was wrong. And since I’ve been asked about this setup a few times now, I decided to put together a very brief intro.
The way I made it work is by having a full “dev environment” running virtually. That means that I check out repositories on the virtual disk and run everything from there. This has the slight inconvenience that I can’t easily access those files with Finder, but the upside is that there is no noticeable IO latency issues like when running Docker for Mac. And VSCode has great drag’n’drop to and from the remote file system, so that covers almost everything.
At the time when I was setting up, none of the big VM providers (VMware, Parallells and VirtualBox) offered a working M1 solution, so I ended up using a wrapper around QEmu called UTM. It’s made for iOS but it runs smoothly on MacOS. The only downside I’ve noticed is that there is no headless option, so I have a superfluous terminal window permanently sitting in my dock.
If you want to do this, first follow the instructions for installing and setting up UTM with a Ubuntu server. When installing the operating system, check the SSH Server option to make sure that is installed. To access it, set up UTM to forward port 22 to the host machine, preferably on a different port to avoid collisions (this is available in the network tab in the configuration window).
Now, to use the server with Visual Studio Code, install the remote extension pack (or just the SSH version if you know that’s the only one you will be using). Set up a new SSH target that accesses localhost on the port that you forwarded. VSCode will now connect to the virtual machine, install host extensions and use it for the “backend” part of your development setup.
As I am running an ARM Linux, there might be a few things that won’t work like I am used to but I am currently running the entire setup for Submotion which is NodeJS and Postgres (running as a Docker image) as well as a few toy Rust projects and so far it all works.
Top comments (0)