If you have an M1 or M2 MacBook Pro, then you probably love it as much as I do. The performance is excellent, the battery life is phenomenal, and I even use my M1 Pro MacBook over my PC most of the time. However, there are some things that it's not quite as good at, and one of those things is running virtual machines. Turns out there's a pretty neat way to run an Ubuntu virtual machine for free on an Apple Silicon Mac, though.
On account of MacBooks using an Arm architecture, x86 software is incompatible, and you'll need to rely on Apple's Rosetta 2 software to translate those x86 instructions to Arm instructions for your software to work. That works great for basic applications like Facebook Messenger and others that don't have native builds, but a full-fledged operating system is a bit of a different beast. Parallels is an alternative option that works on Apple Silicon, but you have to pay for it to the tune of $100 a year. That's where multipass comes in.
Multipass is a free tool that can create Ubuntu virtual machines with just a simple command, and it works on MacOS. With multipass, we're going to create a virtual machine that you can use a remote desktop tool to locally log into. It's a bit finicky, but it's free and does work very well. If you're not up to it but want to use Linux, then be sure to check out some of the best laptops for Linux.
Step 1: Install multipass
The first step is to install multipass, which you can with brew. Run the following command in the Terminal.
brew install multipass
Once installed, you can move onto the next step.
Step 2: Choose an Ubuntu install
This is where you'll choose which Ubuntu version you want to run.
-
First list all of the available images in multipass with the find command in multipass.
multipass find
-
You'll see, at the time of writing, 20.04, 22.04, and 23.04. 22.04 is the latest LTS release, so run the following:
multipass launch 22.04 -n primary -c 4 -m 4G -d 50G
This will start downloading and installing the Ubuntu 22.04 LTS VM. It will then launch it with 4 cores, 4GB of RAM, and 50GB of disk space. You can increase these parameters if you need.
Step 3: Installing a desktop environment in Ubuntu
-
Once you've set up your Linux VM, you'll be logged in on a root-level shell. Run the following command to make sure everything is up to date, including your package index files.
sudo apt-get update && sudo apt-get upgrade
-
Once completed, run the following command to install a Ubuntu desktop and a remote desktop server.
sudo apt-get install ubuntukylin-desktop xrdp -y
- This may take a while to install, so just let it run.
Once it has, you'll need to create a new user account to log into. Run the following commands to create a new account and then add it to the sudo list. "sudo" is the command used to denote administrative access.
sudo adduser <username here>sudo usermod -aG sudo <username here>
Make sure you remember these login details, as you'll need them for the next step.
Step 4: Connecting to your VM
You'll need to find the IP address of your virtual machine, and you'll also need to connect to the remote desktop that it creates. Exit your VM in your Terminal by simply typing "exit," and then type the following command once you are back on the Mac host.
multipass list
This will list the VMs you have installed and running, and you'll see the IPv4 address of the local VM that you need. Keep note of this, and install a tool like Microsoft Remote Desktop to log into your VM.
Once installed, simply add a PC and add the IP address that you saw when you ran "multipass list," add your login details that we created in Step 3, and you're good to go! You should connect to your VM and be able to use it as if it were running in a tool like Parallels. Because it runs locally and you connect to it on the same machine, there should be no latency or bandwidth problems, so it will be indistinguishable from running it in tools like Parallels.
Why you would want an Ubuntu VM on MacOS
If you've gone to the trouble of doing all of this and now you're wondering why, well there are a few reasons. You may want to test software developed specifically for Linux, or you may want to give Ubuntu a try before switching over to it on another machine. Finally, you may just want to tinker with a new operating system for the sake of it!
Regardless, this is a great way to run Ubuntu for free on an Apple Silicon Mac, and it works surprisingly well. You can also use UTM to do the same and run an x86 image on Mac, but that requires a different setup, and an Arm image that you get through multipass will run a lot better.