Skip to content

Instantly share code, notes, and snippets.

@openfirmware
Created November 7, 2018 06:07
Show Gist options
  • Save openfirmware/a78141366efc81421228e40bd39d695d to your computer and use it in GitHub Desktop.
Save openfirmware/a78141366efc81421228e40bd39d695d to your computer and use it in GitHub Desktop.
QEMU with Mac OS 9 guest *and working audio*

QEMU Mac OS 9 Instructions

Here is a short guide on how to build QEMU to run Mac OS 9 with working audio. These instructions work for MacOS High Sierra as the host OS, although with some tweaking they may run under Linux/Windows. You should be comfortable compiling software from source before attempting.

Clone QEMU fork

Adapted from instructions from Cat_7

You may need to install XCode and/or the XCode command line tools. If you do not have them, then this process may prompt you to install them (MacOS will do that).

Start by cloning the fork of QEMU with experimental audio support:

$ git clone -b screamer https://github.com/mcayland/qemu qemu-screamer
$ cd qemu-screamer

Then configure the source to use MacOS CoreAudio. I have also enabled LibUSB, KVM, HyperVirtualization Framework, and the Cocoa UI. In this case I am only compiling the emulator for PPC (32-bit).

$ ./configure --target-list="ppc-softmmu" --audio-drv-list="coreaudio" --enable-libusb --enable-kvm --enable-hvf --enable-cocoa

Then compile:

$ make
$ cd ..

This will create a binary in qemu-screamer/ppc-softmmu/qemu-system-ppc that we can use.

Create HD for Mac OS 9

We will need to have a hard drive image for our emulated system. I made mine 5 GB in size, which is plenty for Mac OS 9.

In our qemu-screamer directory, we will use qemu-img to create the disk image.

$ ./qemu-screamer/qemu-img create -f qcow2 macos92.img 5G

Get a Mac OS 9 Installer

If you have an ISO of a Mac OS 9 install disc (a Mac OS X classic install disc won't work), then you can use that in the next step. If you don't have one, you can download one from Mac OS 9 Lives: Mac OS 9.2.2 Universal Install.

Install Mac OS 9

This won't install quite like Mac OS 9 did, but instead use Apple System Restore to restore an image onto the hard drive.

Start up QEMU with the following options:

$ ./qemu-screamer/ppc-softmmu/qemu-system-ppc -L qemu-screamer/pc-bios -cpu "g4" -M mac99,via=pmu -m 512 -hda macos92.img -cdrom "~/Downloads/Mac OS 9.2.2 Universal Install.iso" -boot d -g 1024x768x32

A breakdown of that command:

  • -L qemu-screamer/pc-bios sets the BIOS. May not actually need this.
  • -cpu "g4" emulate a G4 CPU
  • -M mac99,via=pmu will define the Mac model and enable USB support
  • -m 512 use 512 MB of RAM, could go lower probably
  • -hda macos92.img use our generated disk image for the hard drive
  • -cdrom "~/Downloads/Mac OS 9.2.2 Universal Install.iso" use the ISO for the cdrom
  • -boot d boot from the disk drive
  • -g 1024x768x32 default to 1024x768 resolution and 32 bit colour

Once it starts up, you will be able to run Disk Initializer to format your hard drive image. Go ahead and do that, using Mac OS HFS Extended as the file system. One partition is good.

After initializing the disk, run Apple System Restore with the Mac OS 9 lives disk image as the source and your disk as the destination. This will take a minute to restore. Once done, shut down the emulated system.

Boot Mac OS 9

Similar to the last command, except we start up from the disk we created.

$ ./qemu-screamer/ppc-softmmu/qemu-system-ppc -L qemu-screamer/pc-bios -cpu "g4" -M mac99,via=pmu -m 512 -hda macos92.img -boot c -g 1024x768x32

It should boot up and you will have a running Mac OS 9 with audio!

Tips

When the emulator is shut down, just make a copy of the hard disk image to create a backup. If something breaks your Mac OS 9 installation then you can restore the file.

You can dynamically attach CDs/DVDs to the emulated system by going to the menu bar on your host system for the QEMU application and selecting the option to attach to the CD IDE drive. It will open a dialog letting you select your ISO.

@cat7
Copy link

cat7 commented Mar 6, 2021

The build system was overhauled some time ago. Ninja is required, and indeed builds are now in the /build folder.
--enable-kvm will only work when host and guest are the same architecture which clearly is not the case. But also on a PPC host, --enable-kvm will not work for 32 bit qemu-system-ppc.

@filipe-maia
Copy link

filipe-maia commented Mar 8, 2021

Managed to compile on Ubuntu 20.04 with the following:
./configure --target-list="ppc-softmmu" --audio-drv-list="sdl" --enable-kvm --enable-gtk
make

Thanks for the help.

@macmeister1967
Copy link

Just did this on Hackintosh Mojave 10.14.6, working with sound... many thanks indeed.

PS. Also, the long freezes seem to have stopped when switching from brew-installed qemu, to this custom built one.

PPS. Sometimes qemu seems to hang on shutdown, there is a NVRAM warning/checksum error at startup???

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment