This step-by-step will work on VirtualBox 5.x and 6.x for macOS Sierra 10.12, macOS High Sierra 10.13, macOS Catalina 10.15, and others.

Make sure your system is up to date and all the dependencies are installed.

sudo apt update && sudo apt upgrade -y
sudo apt install virtualbox virtualbox-dkms virtualbox-ext-pack virtualbox-guest-additions-iso virtualbox-guest-utils virtualbox-qt -y

Create a VM using VirtualBox:

  • Name it MacOS,
  • Give 4+ GB of RAM,
  • Give 100+ GB of Storage,
  • Give it 3+ CPUs,
  • Disable Floppy,
  • Enable EFI,
  • Give 128+ MB for Video,
  • Enable 3D Acceleration,
  • Network Adapter work better as Bridged,
  • Add the ISO installation disk to the CD drive.

Go to the Linux terminal and issue the following commands to modify your VM to mimic Apple hardware:

VBoxManage modifyvm "MacOS" --cpuidset 00000001 000106e5 00100800 0098e3fd bfebfbff
VBoxManage modifyvm "MacOS" --cpu-profile "Intel Core i7-6700K"
VBoxManage setextradata "MacOS" "VBoxInternal/Devices/efi/0/Config/DmiSystemProduct" "iMac11,3"
VBoxManage setextradata "MacOS" "VBoxInternal/Devices/efi/0/Config/DmiSystemVersion" "1.0"
VBoxManage setextradata "MacOS" "VBoxInternal/Devices/efi/0/Config/DmiBoardProduct" "Iloveapple"
VBoxManage setextradata "MacOS" "VBoxInternal/Devices/smc/0/Config/DeviceKey" "ourhardworkbythesewordsguardedpleasedontsteal(c)AppleComputerInc"
VBoxManage setextradata "MacOS" "VBoxInternal/Devices/smc/0/Config/GetKeyFromRealSMC" 1
VBoxManage setextradata "MacOS" "VBoxInternal2/EfiGraphicsResolution" "1920x1080"

Many of the commands above can be customized.

  • Do not issue the second line if your processor is not an Intel.
  • Customize the size of the desired screen on the last line with: 1920×1200 1920×1080 1600×1200 1680×1050 1440×900 1280×800 1024×768 640×480
  • Also edit the file MacOS/MacOS.vbox to make modifications of the VM, for example: Display VRAMSize=”256

Start the VM and first set up the partition for the installation using the Disk Utility.

Look for your disk. If it does not show up immediately, click on VIEW then ALL.

Click on Erase and give the name for the new partition.

Close the Disk Utilities and begin the installation.


BONUS

Open the Terminal and install the package manager Brew:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Then, install the basic CLI tools:

brew Install wget
brew Install htop
brew Install tnftp