How to Quickly Spin Up Ubuntu VMs on macOS with Multipass
This guide walks you through installing Multipass on macOS, creating and managing lightweight Ubuntu virtual machines via the command line, including mounting directories, transferring files, automating setup with cloud‑init, and comparing its simplicity to Docker‑style workflows.
Getting Started with Multipass
After trying paid virtual‑machine solutions on macOS, the author discovered Multipass, an open‑source lightweight VM manager from Canonical that runs on Linux, Windows and macOS using KVM, Hyper‑V or HyperKit.
Installation
Download the macOS installer from Multipass website or install via Homebrew:
<code>brew cask install multipass</code>Verify the installation:
<code>multipass --version</code>Creating an Ubuntu Instance
List available Ubuntu images:
<code>multipass find</code>Launch a VM named
vm01with 1 CPU, 1 GB RAM and 10 GB disk:
<code>multipass launch -n vm01 -c 1 -m 1G -d 10G</code>Managing the VM
View running instances:
<code>multipass list</code>Execute a command inside the VM:
<code>multipass exec vm01 pwd</code>Show detailed information:
<code>multipass info vm01</code>Open an interactive shell:
<code>multipass shell vm01</code>Basic Operations Inside the VM
Set a root password and install
nginx:
<code>sudo passwd
su root
apt-get update
apt-get install nginx</code>After installation, the web server can be accessed from the host at the VM’s IP address (e.g.,
192.168.64.2).
Mounting and Transferring Files
Mount a host directory into the VM:
<code>multipass mount /Users/yourname/hello vm01:/hello</code>Transfer a single file:
<code>multipass transfer hello.txt vm01:/home/ubuntu/</code>Unmount when no longer needed:
<code>multipass umount vm01</code>Lifecycle Commands
Start, stop, delete or purge an instance:
<code>multipass start vm01
multipass stop vm01
multipass delete vm01
multipass purge vm01</code>Automating with cloud‑init
Use the
--cloud-initflag to run a YAML configuration on first boot, for example to install Node.js automatically.
Conclusion
Multipass provides a fast, lightweight way to run Ubuntu VMs on macOS, with a Docker‑like workflow and simple CLI commands, making it suitable for development and learning environments.
macrozheng
Dedicated to Java tech sharing and dissecting top open-source projects. Topics include Spring Boot, Spring Cloud, Docker, Kubernetes and more. Author’s GitHub project “mall” has 50K+ stars.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.