Scripts for setting up Multipass virtual machines, in the way of WSL, but on macOS.
Why?
World is a risky place. Sandboxing allows you to separate business account (emails etc.) from developer account (that pulls in stuff from third party sources on the Internet), without disturbing the workflow, too much.
One can use containers for development, but Docker Desktop feels too big a tool for daily use, for this author.
Discipline
Sandboxing of course needs discipline. The mp
approach is done so that:
Tooling is separate from development repos
This is important so that your repos are not cluttered by toolchain choices. A repo would work "just fine" with native tooling, if someone so wishes.
We want to support remote IDE's
However, this does require a beefier machine to run (more cores; more memory). You might opt for partially VM-based workflows, but it's still better than not starting the sandbox transition.
Alternatives
Fully cloud-based sandbox-as-a-service comes to mind.
This can be ideal for you, but this author prefers to have the option of locally hosted, offline-capable development.
It's possible, by -say- 2026, that such remote development platforms become the norm. They certainly have many things going for them, in the same way as multiplayer games have.
rust
; stable
Rust aimed at embedded (ESP32) development.
web
; stable
Cloudflare CLI (wrangler
) on top of generic web tools.
Multipass 1.13.1 installed
Also must work with Multipass 1.14.
The system is intended to work on all macOS, Linux and Windows hosts, but is only tested on macOS. If you find issues, please create an Issue!
Note: For Windows, Pro versions are recommended since only they provide Hyper-V (native) virtualization.
$ rust/prep.sh
[...]
It works the same for
web/prep.sh
.
Multipass IP (rust): 192.168.64.74
cargo 1.80.1 (376290515 2024-07-16)
rustc 1.80.1 (3f5fd8dd4 2024-08-06)
usbip (usbip-utils 2.0)
To add a project folder to be shared between the host (macOS) and the Linux side:
$ multipass mount -type native $(pwd) rust:/home/ubuntu/SOME
$ multipass start rust
Then:
$ multipass shell rust
You are now in an Ubuntu sandbox.
Change your Multipass terminal's look by (right click)
> Show Inspector
. Different coloring helps tremendously!
Multipass does not provide USB pass-through. However, you can reach USB devices using e.g. usbipd-win
.
tbd. If needed, a separate docs/
file about this.
It some some issues with mounts. Until those are resolved, you should:
AVOID any maintenance-like commands on a running instance
This means no multipass mount
, umount
, restart
or delete
.
Instead, do a multipass stop
first, and then the required maintenance command (turning restart
into a stop
+ start
).
This seems to immensely (perhaps completely!) improve the stability of the Multipass VM.
IF you end up in suspicious errors, instantly:
stop
and delete --purge
all instancesmultipass info
gives "no instances"A bit harsh, but.. since you can easily recreate the VM's from nothing (with mp
), shouldn't be worth risking the stability.
IF you get such an error:
$ mp stop --force rust-emb
[2024-08-30T12:30:41.371] [error] [rust-emb] process error occurred Crashed program: qemu-system-x86_64; error: Process crashed
[2024-08-30T12:30:41.373] [error] [rust-emb] error: program: qemu-system-x86_64; error: Process crashed
...restart the Multipass service, and retry the stop
(no host reboot is needed):
$ sudo launchctl unload /Library/LaunchDaemons/com.canonical.multipassd.plist
$ sudo launchctl load /Library/LaunchDaemons/com.canonical.multipassd.plist
$ mp stop rust-emb