How to Install and Run Mac OS X on Hyper-V for Development Testing


2 views

Running Mac OS X on non-Apple hardware has always been a gray area due to Apple's EULA restrictions. However, for development and testing purposes, many engineers explore virtualization solutions. Hyper-V on Windows Server 2008 presents unique challenges because:

  • Apple doesn't provide official Hyper-V drivers
  • OS X expects specific hardware components (like SMC)
  • Hyper-V generation 1 VMs lack proper ACPI implementations

You'll need these elements for the setup:


# Sample PowerShell commands to verify Hyper-V setup
Get-WindowsFeature -Name Hyper-V
Get-VMHost | Select-Object VirtualHardDiskPath, VirtualMachinePath

1. Preparing the VM Configuration

Create a Gen1 VM with these specifications:


New-VM -Name "OSX_Dev" -Generation 1 -MemoryStartupBytes 4GB 
-NewVHDPath "C:\VMs\OSX.vhdx" -NewVHDSizeBytes 60GB

2. Critical BIOS Settings

Modify the VM's configuration file to add these parameters:


<qemu:arg value='-device' />
<qemu:arg value='isa-applesmc,osk=ourhardworkbythesewordsguardedpleasedontsteal(c)AppleComputerInc' />

3. Post-Installation Tweaks

After installation, you'll need to inject these kexts using a tool like Clover Configurator:

  • FakeSMC.kext
  • VoodooPS2Controller.kext
  • NullCPUPowerManagement.kext

To improve graphics performance in your development environment:


# Add this to your config.plist
<key>Graphics</key>
<dict>
    <key>Inject</key>
    <dict>
        <key>ATI</key>
        <false/>
        <key>Intel</key>
        <true/>
    </dict>
</dict>

When encountering kernel panics during boot, try these boot arguments:


-v dart=0 nv_disable=1 kext-dev-mode=1

For network connectivity problems in the VM, consider using the Intel82574L network adapter emulation instead of the default Hyper-V adapter.

If you face persistent issues with Hyper-V, consider these alternatives:

  • Using VMware Workstation with unlocker patches
  • Setting up a KVM-based solution on Linux
  • Dual-booting with a Hackintosh configuration

Running macOS on non-Apple hardware through Hyper-V involves significant technical and legal challenges. While it's technically possible through virtualization, Apple's EULA strictly prohibits installing macOS on non-Apple hardware except for certain development purposes.

For successful macOS virtualization on Hyper-V, your host system must meet these specifications:

  • Intel VT-x or AMD-V virtualization support
  • At least 16GB RAM (32GB recommended)
  • SSD storage with 100GB+ free space
  • Windows Server 2016 or later (Windows Server 2008 lacks proper virtualization support)

First, enable Hyper-V features:

Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V -All
Restart-Computer

Then create a Generation 2 VM with these specifications:

New-VM -Name "macOS_VM" -Generation 2 -MemoryStartupBytes 8GB -NewVHDPath "C:\VMs\macOS.vhdx" -NewVHDSizeBytes 100GB
Set-VMProcessor -VMName "macOS_VM" -Count 4
Set-VMMemory -VMName "macOS_VM" -DynamicMemoryEnabled $false

Since native Hyper-V support for macOS is limited, consider these alternatives:

Using OpenCore Bootloader

OpenCore can help virtualize macOS:

# Sample OpenCore configuration for Hyper-V
<dict>
    <key>ACPI</key>
    <dict>
        <key>Add</key>
        <array>
            <dict>
                <key>Enabled</key>
                <true/>
                <key>Path</key>
                <string>SSDT-HV.aml</string>
            </dict>
        </array>
    </dict>
</dict>

Docker-based macOS

For development testing, consider Docker containers with macOS-like environments:

docker run -it --device /dev/kvm -e DISPLAY=host.docker.internal:0 -v /tmp/.X11-unix:/tmp/.X11-unix macos-docker-image
  • Enable nested virtualization in Hyper-V if available
  • Allocate fixed memory instead of dynamic memory
  • Use VirtIO drivers for disk and network
  • Configure macOS with appropriate SMBIOS settings

Problem: Stuck on Apple logo during boot
Solution: Add npci=0x2000 to boot arguments

Problem: No network connectivity
Solution: Use E1000-82545EM network adapter type