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.
Create a virtual disk(vdi) with a fixed size of around 50GB.
4. Create virtual machine
Create a new virtual machine by clicking on New and name it as MacOS
.
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.
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.
If everything goes well, you may see a screen like below. Click Continue.
Click on Disk utility and partition the attached drive.
Afterwards click on Install and install the system. This will install the OS to the drive.
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.
I hope you have successfully installed macOS for development purposes following this article. Happy hacking.