How to Run MacOS on VirtualBox in Less Than 30 mins

Written by thebojda | Published 2022/05/31
Tech Story Tags: virtualbox | macos | virtual-machine | xcode | ios-app-development | virtualization | virtual-desktop | desktop-environment

TLDRIf you want to develop iOS apps, the easiest way is to buy a Mac or rent one from MacInCloud. But if you like complicated things, you can install your own instance into VirtualBox. via the TL;DR App

If you want to develop iOS apps, the easiest way is to buy a Mac or rent one from MacInCloud, or other providers. But if you like complicated things, you can install your own instance into VirtualBox.

In the first step, create a virtual machine with the “Mac OS X” type and “Mac OS X (64-bit)” version. Memory is a minimum of 4G, but 8G is recommended. Create a dynamically allocated virtual HDD for the VM with a minimum 100G size.

When your VM is created, let’s give it some cores (I allocated 4 cores from my 8 cores), the maximum 128M of video memory, and check 3D acceleration. From the USB panel, use USB 1.1.

The tricky part is the preparation of the VM. You can do so from the command line by running the following script:

#!/bin/sh

# replace ${VM} with your VM name (ex: MacOSX Monterey)
# replace $RES with your resolution (ex: 1920x1080)

VBoxManage modifyvm "${VM}" --cpuidset 00000001 000106e5 00100800 0098e3fd bfebfbff
VBoxManage setextradata "${VM}" "VBoxInternal/Devices/efi/0/Config/DmiSystemProduct" "iMac19,1"
VBoxManage setextradata "${VM}" "VBoxInternal/Devices/efi/0/Config/DmiSystemVersion" "1.0"
VBoxManage setextradata "${VM}" "VBoxInternal/Devices/efi/0/Config/DmiBoardProduct" "Mac-AA95B1DDAB278B95"
VBoxManage setextradata "${VM}" "VBoxInternal/Devices/smc/0/Config/DeviceKey" "ourhardworkbythesewordsguardedpleasedontsteal(c)AppleComputerInc"
VBoxManage setextradata "${VM}" "VBoxInternal/Devices/smc/0/Config/GetKeyFromRealSMC" 1
VBoxManage setextradata "${VM}" "VBoxInternal/TM/TSCMode" "RealTSCOffset"
VBoxManage setextradata "${VM}" "VBoxInternal2/EfiGraphicsResolution" "$RES"

In the last step, mount your OS CD iso, and let’s start the VM.

After a little while, you will see the UI of the installer. Choose your language and click Next.

On the first page, choose “Disk Utility”, and click continue.

Choose your hard disk, click on the erase button, and give a name to your hard drive.

Go back to the first page by quitting from disk utility, and choose Install macOS.

Click on “Continue”, agree to the terms, choose your hard drive as the target medium, and start the installation.

If everything worked well, in about half an hour you will have a brand new Mac VM.

Congratulations. Use it for good things!


Written by thebojda | Freelancer developer, ENVIENTA activist, blogger
Published by HackerNoon on 2022/05/31