-
Install Multipass using Homebrew:
$ brew install --cask multipass ... 🍺 multipass was successfully installed!
-
Verify the installation was successful:
$ multipass version multipass 1.13.1+mac multipassd 1.13.1+mac
-
If you don't have
~/.ssh/id_rsa.pub, you can generate one withssh-keygen -t rsa- If you do not wish to set a password, just hit ENTER when asked for a passphrase
- If you generated a key, close and reopen Terminal to start a new shell session
-
Set up and configure XQuartz, an X11 display server for macOS
- Download and install a DMG directly from the website
- Logout/login or reboot the computer afterward
- Allow X11 forwarding to your host by running
xhost + - Once you have XQuartz running, go to its "Preferences" and check the "Allow connections from network clients" box
-
Create a Linux guest named
primary; yourprimaryinstance gets special treatment with integration to your native filesystem:$ multipass launch --name primary --cpus 4 --mem 4G --disk 10G --cloud-init - <<EOF ssh_authorized_keys: - $(cat ~/.ssh/id_rsa.pub) package_upgrade: true packages: - build-essential EOF
-
You now have a Ubuntu 20.04 (Focal) VM named
primarywith a default user namedubuntu:$ multipass list Name State IPv4 Image primary Running 192.168.64.5 Ubuntu 24.04 LTS
-
In Terminal, determine your Multipass VM's IP address and save it for later steps:
$ IP_ADDRESS=$(multipass info primary --format csv | awk -F, '/^primary/ { print $3 }') $ printf '%s\n' "${IP_ADDRESS:?failed to determine the Multipass VM IP address}" 192.168.64.5
-
We can then use this VM using
multipass shellor through SSH with X forwarding as follows:ssh -X ubuntu@${IP_ADDRESS:?}
- Open VSCode and click on the green button in the bottom left corner; this should open a menu listing several "Remote-SSH" options.
- Click "Remote-SSH: Connect to Host..." and enter
ubuntu@${IP_ADDRESS:?}using the value you looked up in the previous section. - This will open a new VSCode window; feel free to close the old window.
- After a brief installation of the VSCode back end onto your VM, the bottom
left corner's green button should now read
SSH: 192.168.64.5(with your VM's actual IP address).