How to Install MacOSX on Windows 11 WSL2 as Docker - BetaHydri/WSL2MacOSX_Docs GitHub Wiki

1. Install WSL on Windows 11 and reboot

wsl.exe –install

[doc] https://docs.microsoft.com/en-us/windows/wsl/install

2. Add nestedVirtualization to the end wsl2 config file (If the file doesn't exist, create it).

  • C:/Users/<Your_user>/.wslconfig

[wsl2]

nestedVirtualization=true

3. Download and install Docker for Windows and reboot

https://desktop.docker.com/win/main/amd64/Docker%20Desktop%20Installer.exe image

image

image

image

4. Ensure x11-apps is installed. Use the command:

  • sudo apt update && sudo apt upgrade
  • sudo apt install x11-apps -y
  • sudo apt install cpu-checker
  • kvm-ok

image

5. Finally Run Docker command inside wsl bash - to run MacOSX big-sur or monterey

  1. sudo su
  2. big-sur MacOSX:

docker run -i --device /dev/kvm -p 5999:5999 -p 5998:5998 -v /tmp/.X11-unix:/tmp/.X11-unix -e "DISPLAY=${DISPLAY:-:0.0}" -e EXTRA="-display none -vnc 0.0.0.0:99,password=on" sickcodes/docker-osx:big-sur


  1. sudo su
  2. Monterey MacOSX:

docker run -it --device /dev/kvm -p 5999:5999 \ -p 5998:5998 \ -v /tmp/.X11-unix:/tmp/.X11-unix -e "DISPLAY=${DISPLAY:-:0.0}" -e EXTRA="-display none -vnc 0.0.0.0:99,password=on" -e GENERATE_UNIQUE=true -e MASTER_PLIST_URL='https://raw.githubusercontent.com/sickcodes/osx-serial-generator/master/config-custom.plist' sickcodes/docker-osx:Monterey

Sample docker imaging install process output:

image

6. Set VNC password to be able to connect with VNC Viewer.

  • Type: change vnc password into the docker terminal and set a VNC password (must be repeated when restarting MacOSX docker image)
  • Next follow: STEP 7
  • (When you want to stop QEMU and stop Docker image type: q)
  •   To start docker image: docker start -a -i `docker ps -q -l`
    

image

7. Download VNC Viewer for Windows and connect to MACOSX

Download VNC Viewer for Windows | VNC® Connect (realvnc.com)

  • Start VNC Viewer and connect to localhost:5999 (Docker MACOSX)

image

  • Type in VNC password that you have set in step 6 image

  • Wait until installation screen appears this may happen after several automatic reboots

image

8. Installation Screen 1st prepare/erase partition and then install MacOSX

  • Select Disk Utility to erase QEMU Hardisk Media (Virtualized: First Disk)

image

image

  • After HDD has been erased, **exit ** disk utility and Install MacOSX

image

image

  • Install MacOSX Big-Sur on the erased HDD (can take up-to 2-3 hours)

image

image

Finally, MacOS (Monterey) is running

image

⚠️ **GitHub.com Fallback** ⚠️