DEV Community

Danilo Desole
Danilo Desole

Posted on

How to virtualise on Apple M1

I recently got a new MacBook Pro backed by the "almost" new Apple M1 socket, it's just brilliant and the battery life it's just astonishing, I'm able to run multiple workloads, have a always-on Fedora VM, and the battery won't die before the second day.

I usually run a separated environment for my development, this allows me to keep my machine pristine (I used to do that with my previous laptop, Dell XPS 15) from dev dependencies and files that I'll never remove. In this article I'd like to show you how I virtualise on Mac and how I use VM to develop.

Please note that I'm not affiliated with any of the software/vendor below. What I'm writing is from my own experience.

Virtualisation Options

UTM

UTM is an Open Source virtualisation software able to run Linux, Windows and OSX even on Apple M1. UTM allows you to run the virtualisation as-is or to use Rosetta and emulate an intel-like processor. I really like the UI simplicity and the software itself is just made to do what's supposed to, without too many features that sometime can be overwhelm.

PRO

  • Free / paid for 12€ on mac store
  • Same features as Parallels (as much as I’m concerned)
  • Open Source
  • Offer different types of virtualisation (even with Rosetta)

CONS

  • Sometimes it can be challenging to create a new VM (the install process may fail if virtualisation is not set correctly)
  • Need at least an additional settings screen to setup the IP ranges for the created VMs
  • Installing Windows is really challenging as you need to basically create the ISO file (from a Windows machine...)
  • Graphic acceleration doesn't work well on Windows

Parallels

Parallels is a top-tier emulation software, the VM creation process is straightforward with a Wizard that guide you through all the steps, many automated. It provides a lot of customisations and options to literally unleash the real virtualisation power. This is my fav if you use virtualisation for business reason as you get extensive support with the business version.

PRO

  • It is straightforward and intuitive
  • Creation process easy
  • Mapping of CMD to CTRL

CONS

  • License is annual and expensive
  • Doesn’t offer that much more rather than UTM (for my daily usage)

VSCode

Now VSCode allows you to SSH into a Linux VM, then it installs a VSCode-Server and let you code on the connected machine as you were in local. Additionally, to my surprise, it also automatically set port-forwarding, therefore if you start a web-server it will automatically forward your localhost:something to you ssh-machine:something.

What I've done is

  1. I created an SSH key and installed it on my VM
  2. I set a static IP so it won't change on reboot
  3. Open VSCode and install the Remote SSH extension
  4. Connect to the VM
  5. Happy coding!

Happy to answer any question, please let me know if you'd like to see more pictures and if this article is clear :)

Special thanks to Morten for his tips and tricks.

Cheers
Danilo

Top comments (0)