Skip to content
This repository was archived by the owner on Feb 15, 2024. It is now read-only.
This repository was archived by the owner on Feb 15, 2024. It is now read-only.

macOS on VirtualBox on WSLg #525

Closed
Closed
@myspaghetti

Description

@myspaghetti

Here's a sort-of tutorial for compiling the vboxdrv module for WSLg, adapted from the Darling guide and the Hanna J guide.

No support is offered for installing WSLg, compiling a kernel, or compiling and loading the vboxdrv module.

This process can and will break, since WSLg is still in beta. Without further ado:

  • Install Windows 11
  • Install WSLg, update WSLg, launch WSLg
  • On the WSLg command prompt, update the package repository: sudo apt update
  • Install the build dependencies: sudo apt install build-essential flex bison libssl-dev libelf-dev git -y
  • Clone the 5.10.y kernel branch: git clone --depth 1 --single-branch --branch linux-msft-wsl-5.10.y 'https://github.com/microsoft/WSL2-Linux-Kernel.git' linux-msft-wsl-5.10.y
  • cd linux-msft-wsl-5.10.y
  • cp Microsoft/config-wsl .config
  • sudo make -j $(expr $(nproc) - 1)
  • sudo make modules_install
  • sudo apt install virtualbox-source
  • tar -xf /usr/src/virtualbox.tar.bz2
  • cd modules/virtualbox/vboxdrv
  • sudo make -C ~/linux-msft-wsl-5.10.y/ M=${PWD}
  • sudo insmod vboxdrv.ko

Hooray, now you can run the script, version 0.99.1.0 or higher, and install macOS on VirtualBox on WSLg, super-slowly.

  • sudo apt install bash coreutils gzip unzip wget xxd dmg2img virtualbox -y
  • mkdir ~/macOS
  • cd ~/macOS
  • wget https://raw.githubusercontent.com/myspaghetti/macos-guest-virtualbox/master/macos-guest-virtualbox.sh
  • bash -i macos-guest-virtualbox.sh

Follow the script and you're done. Please mind that in my limited experience, there appears to be some disk I/O issue which slows the VirtualBox VM considerably, so booting macOS takes about ten minutes and installation takes many hours. If you're already compiling kernels and kernel modules, you might as well skip VirtualBox altogether and head directly to OSX-KVM on WSL2/WSLg which is a lot faster.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or requestwon't fixThis will not be worked on

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions