-
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
; yourprimary
instance 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
primary
with a default user namedubuntu
:$ multipass list Name State IPv4 Image primary Running 192.168.64.5 Ubuntu 24.04 LTS
-
We can then use this VM using
multipass shell
or through SSH with X forwarding as follows:$ ssh -X ubuntu@$(multipass info primary --format csv | awk -F, '/^primary/ { print $3 }')
- 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>
, replacing with the address of your Multipass VM. - 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: <ip_address>
.