I’ve mentioned UTM before. It’s a nice wrapper for QEMU that enables you to create ARM virtual machines and emulate non-ARM machines on macOS. It’s a free download from the website, or you can get it in the app store. But one of the features I’ve been looking forward to is being able to use Rosetta to do X64 to ARM64 instruction translation, which is supported in the latest version of UTM on macOS Ventura. I was hoping to be able to install Intel VMs using Rosetta, but for that you still have to use QEMU. What you can do is install a Debian ARM VM, enable Rosetta, and then run X64 Debian packages on that VM. This can be useful if there’s a particular package you need that doesn’t have a native ARM build. Thus far I’ve only got it to run packages, and not individual Intel binaries. There is also a big caveat:
There is a bug present in Linux virtual machines on Ventura and the base M1 chip that causes the virtual machine to randomly kernel panic and freeze. Unfortunately, this means that base M1 users should avoid Apple Virtualization backend until Apple or Linux maintainers provide a fix.
Set up the VM
- Open UTM and click Add ( ➕ ) to open the VM creation wizard.
- On the Start panel, click Virtualize, then on the Operating System panel, click Linux.
- On the Linux panel, select Use Apple Virtualization, then select Enable Rosetta (x86_64 Emulation).
- Click Browse and select the Debian installer ISO you downloaded earlier, then click Next.
- Choose the amount of RAM and CPU cores you want the VM to use, then click Next. I used the default settings.
- Set the maximum drive space to allocate, then click Next. I left this at the default 64GB. The image won’t take up the full amount when you create it, and can be trimmed if you have sufficient disk space for a copy, so you should set this to the maximum amount you think you’ll need.
- (Optional) Choose a shared folder to mount in the VM, then click Next. If you skip this step, you can select the folder later from the VM toolbar.
- Click Save to create the VM and then click Run ( ▶️ ) to start the VM.
- When the VM boots, select Install and follow the setup wizard.
- When formatting the disk, install to Virtual disk 1 (vda), using entire disk, all files in one partition
- From Software selection, select GNOME, SSH server and standard system utilities.
- After installation, eject the disk and reboot.
$ set USERNAME=`whoami` $ su -p # /usr/sbin/usermod -aG sudo $USERNAME
After you enable sudo for the default user, you must restart the VM for the change to take effect.
Install the software
- Install the guest tools:
sudo apt install spice-vdagent.
- Install binary format support:
sudo apt install binfmt-support.
- Create a mount point:
sudo mkdir /media/rosetta.
- Mount Rosetta:
sudo mount -t virtiofs rosetta /media/rosetta.
- Add this line to
rosetta /media/rosetta virtiofs ro,nofail 0 0.
- Register Rosetta as an X64 ELF handler:
sudo / usr / sbin / update - binfmts--install rosetta / media / rosetta / rosetta \ --magic "\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x3e\x00" \ --mask "\xff\xff\xff\xff\xff\xfe\xfe\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff" \ --credentials yes--preserve no--fix - binary yes
The magic parameter describes the first 20 bytes of the ELF header for X64 binaries. The Linux kernel performs a bitwise logical AND with the first 20 bytes of any binary you try to run with the mask value. If there’s a match, it uses the registered handler to interpret the binary. Otherwise, it reports an error.
7. Enable X64 packages:
sudo dpkg --add-architecture amd64 sudo apt update
Now you can now install and run any X64 package in the Debian repository with
sudo apt install packagename:amd64.
One such package is WINE, which will enable you to run some 64-bit Windows binaries. But you’ll also need to install WINE32 to get it to launch. I’m not sure if Rosetta can be persuaded to run 32-bit binaries as well. I’ll have to do some further investigation. You’ll also need to enable X86 packages:
sudo dpkg --add-architecture i386 sudo apt update
Then you can install WINE with:
sudo apt install wine64:amd64 sudo apt install wine32:i386
So far, I’ve only got the built-in file explorer working (launch with
wine64 explorer). If I get 32-bit apps working I’ll write a new article on it.