UTM: Run x86 VM on Mac M1

Contents
UTM is a full-featured system emulator and virtual machine host for iOS and macOS. It is based off of QEMU.
Typical tasks
- run docker images designed for amd64(or any other including RISC) on Apple Silicon (M1, M2 chips)
- compile code for amd64(or any other including RISC) on Apple Silicon (M1, M2 chips)
- run and test application developed not for on Apple Silicon (M1, M2 chips)
UTM VM setup for Ubuntu
Get UTM via brew
brew install --cask utm
Choose:
- [Option A]: install OS from UTM gallery https://mac.getutm.app/gallery/
- [Option B]: Install OS manually. You need ISO file for desired OS!
Below UTM config works for Ubuntu version 14/16/18/22
Edit VM:
- System:
- Architecture: x86_64
- System: Standard PC (i440FX + PIIX, 1996) (alias of pc-i440fx-7.0)
- CPU cores: 4
- QEMU:
- Tweaks: RNG Device, Use local time for base clock, Force PS/2 controller
- Network:
- Network Mode: Emulated VLAN
- Emulated Network Cartd: rtl8139
- Port Forwarding: Host(2022)->Guest(22)
If port forwarding configured as above user ubuntu:ubuntu can login via ssh
ssh [email protected] -p 2022
File sharing (!to be tested)
- via Spice drive
sudo apt install spice-vdagent spice-webdavd
- via SMB
sudo apt-get install cifs-utils
sudo mount -t cifs //10.0.2.2/shared ~/shared
Performance results (not finished)
Benchmarking software used https://github.com/akopytov/sysbench
Prepared:
- Host: MAC Monterey 12.6.1, M1 pro 10 cores, 32GB RAM
brew install sysbench
- UTM Emulated guest: Ubuntu 22.04.1 LTS, 4 cores, 4GB RAM
sudo apt-get install sysbench
CPU Benchmark results
sysbench cpu --threads=$NUMBER_OF_THREADS --cpu-max-prime=200000 run
Host, threads=1 | Guest, threads=1 | Host, threads=2 | Guest, threads=2 | |
---|---|---|---|---|
events/sec | 134361546 | 14.43 | 25967909.85 | 13.39 |
exec time | 3.4302 | 10.0377 | 8.3293 | 9.9731 |
Increasing of $NUMBER_OF_THREADS just makes the results worse on HOST and GUEST systems
MEM Benchmark results
sysbench --threads=$NUMBER_OF_THREADS --test=memory --memory-block-size=1M --memory-total-size=30G run
H 1 | G 1 | H 2 | G 2 | |
---|---|---|---|---|
— | — | — | — | — |
I/O
Not needed
7zip
7z b
UTM VM setup for Windows 11
Get Windows® 11 installer ISO images by crystalfetch
brew install --cask crystalfetch
To run ARM (AARCH64): create a New Virtual Machine > Virtualize > Windows To run x64 (AMD64): create a New Virtual Machine > Emulate > Windows
Setup wizard options:
[x] Install Windows 10 or higher
[ ] Import VHDX Image
Boot ISO Image: <image from crystalfetch>
[x] Install drivers and SPICE tools
[x] Open VM Settings
VM Settings:
CPU: 4
Memory: 4096 MB
Network Mode: Bridged
Windows setup network issue: https://docs.getutm.app/guides/windows/#networking-does-not-work