LoginSignup
2
0

More than 3 years have passed since last update.

Setting up macOS on virtualbox

Last updated at Posted at 2020-02-13

VirtualBox

6.1 (or later) should be used as it has built-in APFS boot support.

Making ISO

Sierra

sierra.bash
hdiutil attach ./InstallESD.dmg -noverify -nobrowse -mountpoint /Volumes/esd
hdiutil create -o Sierra.cdr -size 7316m -layout SPUD -fs HFS+J
hdiutil attach Sierra.cdr.dmg -noverify -nobrowse -mountpoint /Volumes/iso
asr restore -source /Volumes/esd/BaseSystem.dmg -target /Volumes/iso -noprompt -noverify -erase
rm /Volumes/OS\ X\ Base\ System/System/Installation/Packages
cp -rp /Volumes/esd/Packages /Volumes/OS\ X\ Base\ System/System/Installation
cp -rp /Volumes/esd/BaseSystem.chunklist /Volumes/OS\ X\ Base\ System/
cp -rp /Volumes/esd/BaseSystem.dmg /Volumes/OS\ X\ Base\ System/
hdiutil detach /Volumes/esd
hdiutil detach /Volumes/OS\ X\ Base\ System
hdiutil convert Sierra.cdr.dmg -format UDTO -o Sierra.iso
mv Sierra.iso.cdr Sierra.iso 
rm Sierra.cdr.dmg

HighSierra/Mojave/Catalina

git clone https://github.com/kholia/OSX-KVM/

Basic setup

NAME=macOS
VBoxManage createvm --name "$NAME"
VBoxManage registervm "$HOME/VirtualBox VMs/$NAME/$NAME.vbox"
VBoxManage modifyvm "$NAME" --ostype MacOS1013_64
VBoxManage modifyvm "$NAME" --memory 4096
VBoxManage modifyvm "$NAME" --acpi on
VBoxManage modifyvm "$NAME" --ioapic on
VBoxManage modifyvm "$NAME" --cpus 2
VBoxManage modifyvm "$NAME" --nic1 nat --nictype1 82540EM
VBoxManage modifyvm "$NAME" --chipset piix3
VBoxManage modifyvm "$NAME" --vram 64
VBoxManage modifyvm "$NAME" --firmware efi64
VBoxManage modifyvm "$NAME" --usb on --usbxhci on
VBoxManage modifyvm "$NAME" --mouse usbtablet
VBoxManage modifyvm "$NAME" --cpuidset 00000001 000106e5 00100800 0098e3fd bfebfbff
VBoxManage setextradata "$NAME" "VBoxInternal/Devices/efi/0/Config/DmiSystemProduct" "iMac11,3"
VBoxManage setextradata "$NAME" "VBoxInternal/Devices/efi/0/Config/DmiSystemVersion" "1.0"
VBoxManage setextradata "$NAME" "VBoxInternal/Devices/efi/0/Config/DmiBoardProduct" "Iloveapple"
VBoxManage setextradata "$NAME" "VBoxInternal/Devices/smc/0/Config/DeviceKey" "ourhardworkbythesewordsguardedpleasedontsteal(c)AppleComputerInc"
VBoxManage setextradata "$NAME" "VBoxInternal/Devices/smc/0/Config/GetKeyFromRealSMC" 1
VBoxManage storagectl "$NAME" --name SATA --add sata --bootable on

Storage setup

VBoxManage createhd --size 50000 --variant standard --filename "$HOME/VirtualBox VMs/$NAME/$NAME.vdi"
VBoxManage storageattach "$NAME" --storagectl SATA --port 1 --type hdd --medium "$HOME/VirtualBox VMs/$NAME/$NAME.vdi"
VBoxManage storageattach "$NAME" --storagectl SATA --port 2 --type dvddrive --medium OSX.iso

Sierra hack

VBoxManage modifyvm "$NAME" --ostype MacOS_64
VBoxManage modifyvm "$NAME" --chipset ich9
VBoxManage modifyvm "$NAME" --system-uuid-le off
VBoxManage modifyvm "$NAME" --usbxhci on
VBoxManage setextradata "$NAME" "VBoxInternal/Devices/efi/0/Config/DmiBoardProduct" "Mac-F22589C8"
VBoxManage setextradata "$NAME" "VBoxInternal/Devices/efi/0/Config/DmiSystemSerial" "CK1156I6DB6"
VBoxManage modifyvm "$NAME" --paravirtprovider none
# VBoxManage modifyvm "$NAME" --paravirtprovider default # apply after installation
2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0