x86 macOS relevant now?

Anything about Mac emulation that does not belong in the above categories.

Moderators: Cat_7, Ronald P. Regensburg

Post Reply
rpatters1
Tinkerer
Posts: 52
Joined: Sun Jul 27, 2008 3:24 pm

x86 macOS relevant now?

Post by rpatters1 »

Now that x86 macOS is moving into legacy status, is there any interest on this forum for adding information about how to emulate it? FWIW: I managed to create a virtual Mac OS Lion that mostly works with qemu. If anyone is interested I can post the instructions. (I basically used UTM to set up the virtual then hacked out the qemu settings to run it directly with qemu.)
User avatar
Cat_7
Expert User
Posts: 6145
Joined: Fri Feb 13, 2004 8:59 am
Location: Sittard, The Netherlands

Re: x86 macOS relevant now?

Post by Cat_7 »

Of course we are interested in the instructions, after all we are about mac emulation ;-)
Even though I hope that the Intel machines will still be around and supported for a while.

I assume these instructions are for running Qemu with Intel MacOS on a M1 machine as that would be emulation?

Best,
Cat_7
rpatters1
Tinkerer
Posts: 52
Joined: Sun Jul 27, 2008 3:24 pm

Re: x86 macOS relevant now?

Post by rpatters1 »

Currently I am still on an x86 Mac, but I have every reason to believe this same code will work on Silicon. (Indeed, I plan to upgrade to a Silicon Mac in the coming months, which is why I am investigating this now.) In fact, I have hopes it will work better on a Silicon Mac than it does on my current Mac.

I got the UTM instructions from this website. That's also where you'll find links to the EFI-xxx.img and OVFM.bin images you'll need. Finally, if you need to install Lion from scratch, the install disc image is Contents/SharedSupport/InstallESD.img, and it is found by "Open Package Contents" on the Lion installer app.

You also need to know the osk key for macOS hardware. To make sure we're clean with lawyers, I am not going to copy it in this post, but it is easily findable if you search "osk key for macOS".

However, I did not install Lion. I converted a VMWare Fusion disc. Just open the package contents of the VMWare virtual machine (the .vmwarevm) and find the Virtual Disk.vdsk file. Use the following command to convert it to qcow2. (You can use any file name, but I chose MacOS.7.qcow2:

Code: Select all

qemu-img convert -O qcow2 "Virtual Disk.vdsk" MacOS.7.qcow2
And here is my qemu.command

Code: Select all

#!/bin/bash
cd "$(dirname "$0")"

qemu-system-x86_64 -machine q35, -accel tcg,thread=multi,tb-size=1536 \
      -bios OVMF.bin -m 4096 \
      -cpu Penryn,+ssse3,+sse4.1,+sse4.2 \
      -smp 4,cores=2 \
      -usb -device usb-kbd -device usb-tablet \
      -device isa-applesmc,osk="actual-osk-key-goes-here" \
      -netdev user,id=usr0 -device e1000-82545em,netdev=usr0,id=vnet0 \
      -device usb-storage,drive=drive1,removable=false,bootindex=0 \
      -drive if=none,media=disk,id=drive1,file=EFI-LEGACY.img \
      -device ide-hd,bus=ide.2,drive=MacHDD,bootindex=1 \
      -drive id=MacHDD,if=none,file=MacOS10.7.qcow2 \
      -monitor stdio
If you need to install qemu, on mac it's simply

Code: Select all

brew install qemu
NOTE: this installs a *lot*, I mean a *lot* of dependencies and takes quite a while.

There are plenty of other websites with instructions for installing qemu on Linux and Windows.

Finally, I was able to access my host drive (on Big Sur) by setting up an smb network share. The afp share does not appear to work, possibly for the same reason I couldn't get it to work on Tiger. Big Sur seems to have dropped compatibility for older versions of afp.
User avatar
Cat_7
Expert User
Posts: 6145
Joined: Fri Feb 13, 2004 8:59 am
Location: Sittard, The Netherlands

Re: x86 macOS relevant now?

Post by Cat_7 »

Hi,

Thanks for the info. You might want to take a look at the -accel tcg parameter.
Qemu supports virtualisation on Intel Mac, so things could perhaps be sped up by setting it to -accel hvf

Best,
Cat_7
rpatters1
Tinkerer
Posts: 52
Joined: Sun Jul 27, 2008 3:24 pm

Re: x86 macOS relevant now?

Post by rpatters1 »

It turns out that the OS boot crashes instantly if you use -accel hvf, causing an endless loop between OVFM and EFI. UTM has the same problem (on Intel Macs). Since this VM is ultimately a solution I am looking at as a migration plan for Silicon Mac, I am not particularly concerned about it.
rpatters1
Tinkerer
Posts: 52
Joined: Sun Jul 27, 2008 3:24 pm

Re: x86 macOS relevant now?

Post by rpatters1 »

Another issue I have with it is that only one screen resolution is available: 1280x720. If you have a suggestion for how to get more options, I'd be interested in hearing it.
FreeRepublic
Student Driver
Posts: 13
Joined: Fri May 17, 2019 8:37 pm

Re: x86 macOS relevant now?

Post by FreeRepublic »

I run Mac OS9 through emulation on my ASUS Windows computer. It works great.

Mac Classic emulation on an Android tablet?
rpatters1
Tinkerer
Posts: 52
Joined: Sun Jul 27, 2008 3:24 pm

Re: x86 macOS relevant now?

Post by rpatters1 »

I finally got around to following this up, now that I have my M1 Mac. This qemu prompt works great for me. The -accel tcg is a useful addition.

(Replace the osk key for macOS hardware with the actual key value. You can search "osk key for macOS hardware" to find it.)

Code: Select all

qemu-system-x86_64 -machine q35, -accel tcg,thread=multi,tb-size=1536 \
      -bios -x86/OVMF.bin -m 4096 \
      -cpu Penryn,+ssse3,+sse4.1,+sse4.2 \
      -smp 4,cores=2 \
      -usb -device usb-kbd -device usb-tablet \
      -accel tcg \
      -device isa-applesmc,osk="actual-osk-key-goes-here" \
      -netdev user,id=usr0 -device e1000-82545em,netdev=usr0,id=vnet0 \
      -device usb-storage,drive=drive1,removable=false,bootindex=0 \
      -drive if=none,media=disk,id=drive1,file=-x86/EFI-LEGACY.img \
      -device ide-hd,bus=ide.2,drive=MacHDD,bootindex=1 \
      -drive id=MacHDD,if=none,file=MacOS10.7.qcow2 \
      -monitor stdio
As described above, I was able to convert my VMWare Fusion Lion disc to qemu and continue to use it, without the need reinstall Lion.
User avatar
adespoton
Forum All-Star
Posts: 4226
Joined: Fri Nov 27, 2009 5:11 am
Location: Emaculation.com
Contact:

Re: x86 macOS relevant now?

Post by adespoton »

I don't believe you actually need the OSK key -- your OpenCore legacy EFI should take care of that for you. The rest looks right.

Now if only we could get this configuration working for 10.6 -- I still haven't got around to generating an OpenCore 0.8.8 legacy EFI that actually functions with 10.6.
User avatar
Lucss21a
Inquisitive Elf
Posts: 27
Joined: Sat Mar 05, 2022 1:03 pm

Re: x86 macOS relevant now?

Post by Lucss21a »

Interesting topic here, as I currently use a x64 machine (which might be cheating) but I am also thinking about OS X/macOS amd64 emulation (or virtualization).

Iirc, macOS 10.13 and later doesn't have graphic accel available unless if you use something like IOMMU GPU passthrough, but I'm interested in the much older versions.

I experimented with Mac OS X 10.5 Leopard inside VMware Workstation 16 on Windows 10, and it's horribly slow sometimes. But since I also have Linux, I might do it again in QEMU with improved configs. As well as try running Mac OS X 10.4 Tiger x86 and PPC side to side.

Code: Select all

Off-topic comment: Speaking of PPC, did Mac OS X 10.5 work on QEMU PPC?
User avatar
adespoton
Forum All-Star
Posts: 4226
Joined: Fri Nov 27, 2009 5:11 am
Location: Emaculation.com
Contact:

Re: x86 macOS relevant now?

Post by adespoton »

Lucss21a wrote: Sat Nov 25, 2023 2:08 pm Interesting topic here, as I currently use a x64 machine (which might be cheating) but I am also thinking about OS X/macOS amd64 emulation (or virtualization).

Iirc, macOS 10.13 and later doesn't have graphic accel available unless if you use something like IOMMU GPU passthrough, but I'm interested in the much older versions.

I experimented with Mac OS X 10.5 Leopard inside VMware Workstation 16 on Windows 10, and it's horribly slow sometimes. But since I also have Linux, I might do it again in QEMU with improved configs. As well as try running Mac OS X 10.4 Tiger x86 and PPC side to side.

Code: Select all

Off-topic comment: Speaking of PPC, did Mac OS X 10.5 work on QEMU PPC?
As long as you're using a recent host macOS, UTM should work on x86_64. It has the Apple VM layer and UTM 7.x under the hood, and is compiled against SPICE. This makes some hardware passthrough available under x86_64 __as long as you're not using TCG__. And for 10.14.3? and later, Apple has helpfully provided virtualization drivers for many things in the host OS to allow for passthrough. So 10.13 and early 10.14 are the only places you won't be able to use acceleration if the guest is virtualized.

As for GPU in general, no current emulators support hardware graphics accel.

10.5 works great under QEMU-PPC; there's of course no graphics acceleration, but that's not an issue in most cases, as the CPU graphics are more than fast enough on modern hardware.

Still not working at all under TCG emulation are: 10.4 x86, 10.5 x86, 10.6 x86, 10.6 x86_64. These work fine under QEMU virtualization on x86_64 hardware (directly or via KVM), as well as on VMWare, VirtualBox and Parallels (I've never attempted them under HyperV). Also, anything above 10.14 isn't really worth emulating (only virtualizing) under QEMU, as the lack of hardware graphics support slows them to a crawl.
Post Reply