Run macOS in Virtualbox on Linux OS

I am on Manjaro OS, but it should not matter what OS you are on. The end result of this article is to run macOS in Virtualbox on any Linux OS.

What is the purpose of running macOS on Linux? You may ask. Reasons could differ, but for me was to built Nextcloud desktop app for macOS. It turns out the installation and setup is very easy and straight forward.

Disclaimer: I am not the author of any third party contents or materials such OS iso.

1. Download the ISO

Download macOS Catalina(10.15.x) from the link below.

2. Install Virtualbox

Install Virtualbox and it’s required modules on Manjaro.

sudo pacman -S virtualbox virtualbox-guest-utils virtualbox-host-dkms linux510-virtualbox-host-modules

I am using Kernel 5.10 and selected linux510-virtualbox-host-modules for installation, you can change it to the Kernel you have.

3. Create virtual disk(vdi)

Open Virtualbox and click on File menu and select Virtual Media Manager. A new window will open, click on Create button.

Virtualbox-create-vdi

Create a virtual disk(vdi) with a fixed size of around 50GB.

Virtualbox-choose-vdi-size

4. Create virtual machine

Create a new virtual machine by clicking on New and name it as MacOS.

Virtualbox-main-screen

Click on the Settings button for the VM you just created. Click on Storage tab and attach the drive you created above. Attach the ISO file too of the macOS you downloaded.

Virtualbox-MacOS-settings-storage-tab

You can quickly check the other settings to change RAM, CPU, Video Memory(128MB) values etc.

After saving the settings, close Virtualbox.

5. Setup Virtualbox

There is an extra step needed to run macOS successfully. Download the script(setup.sh) from this link and make it executable.

chmod +x setup.sh

You don’t need to change anything. Run the script:

./setup.sh -v MacOS -r 1980x1080

After running the script successfully, open Virtualbox and start the macOS VM.

6. Install macOS

Wait for the OS to boot, it may take some time.

MacOS-booting

If everything goes well, you may see a screen like below. Click Continue.

MacOS-setup-screen

Click on Disk utility and partition the attached drive.

MacOS-disk-utility

Afterwards click on Install and install the system. This will install the OS to the drive.

MacOS-installation

Note: As these images(iso file) are taken from the OS installed machines. A user is already bind to it. What you can do is just create a new one with your username and password after installation is finished.

MacOS-login-screen
MacOS-about-screen

I hope you have successfully installed macOS for development purposes following this article. Happy hacking.