UPDATED HOW TO: Install macOS Big Sur With OpenCore on Linux

 

UPDATE: Back in August 2020 I showed you how to install macOS Big Sur with OpenCore on Linux. Back then Big Sur was in beta and you had to take some extra steps to install it. Now, that Big Sur is out of beta, the installation process was simplified and I’ve decided to create a new tutorial instead of editing the old one, to avoid any confusion. Let’s get started…

If you’re running a Linux distro as your daily driver, you can still other distros and OS’. You can even enjoy macOS. You can run Catalina using the clover bootloader and you can even install macOS in a Docker container.

Today we’re going to take a look at how set up a simple macOS Big Sur VM in QEMU, accelerated by KVM.

ALSO READ HOW TO: Dual Boot macOS and Linux

 

REQUIREMENTS

  • A modern Linux distribution
  • QEMU > 2.11.1
  • A CPU with Intel VT-x / AMD SVM support is required
  • A CPU with SSE4.1 support is required for >= macOS Sierra
  • A CPU with AVX2 support is required for >= macOS Mojave
  • Internet access for the installation process

 

INSTALL QEMU & OTHER REQUIRED PACKAGES

Open the terminal and run: sudo apt install qemu uml-utilities virt-manager dmg2img git wget libguestfs-tools p7zip

NOTE: Adjust install command and, possibly, packages names according to your distro.

 

 

INSTALL macOS Big Sur

1. Open the terminal and run git clone --depth 1 https://github.com/kholia/OSX-KVM.git macOS-Big-Sur. When you’re done cloning the git repo, cd into path with cd macOS-Big-Sur

 

2. Download macOS Big Sur installer from Apple with ./fetch-macOS.py.

NOTE: Here you can choose which macOS you want to install. We will install Big Sur.

 

When the download is done, you should have InstallAssistan.pkg in your folder.

 

3. Now we need to unpack the downloaded InstallAssistan.pkg. To do this run 7z e -txar InstallAssistant.pkg '*.dmg'

 

This should give you the SharedSupport.dmg file

 

4. You’ll need to extract Basesystem.dmg from SharedSupport.dmg. First run 7z e -tdmg SharedSupport.dmg 5.hfs

 

Next create a folder called stuff with mkdir stuff and mount the hfs filesystem to the stuff folder with sudo mount -oloop *.hfs stuff

 

Inside the stuff/com_apple_MobileAsset_MacSoftwareUpdate folder, there’s a .zip file.

Run 7z l stuff/com_apple_MobileAsset_MacSoftwareUpdate/*.zip to list the contents of the .zip file with and you will see it contains the Basesystem.dmg that we need.

 

5. Copy the .zip file to your Desktop with cp stuff/*MacSoftwareUpdate/*.zip ~/Desktop

 

Extract Basesystem.dmg located inside the zip file on your Desktop > AssetData > Restore

 

Now move the Basesystem.dmg back to your macOS Big Sur folder and you can unmount the stuff folder created earlier with sudo umount stuff.

 

6.  Convert BaseSystem.dmg to BaseSystem.img with qemu-img convert BaseSystem.dmg -O raw BaseSystem.img

 

 

7. Create a virtual HDD image where macOS will be installed. Run qemu-img create -f qcow2 mac_hdd_ng.img 128G

NOTE: You can change the size of the virtual drive. 128 GB is just an example. Also if, for any reason, you want to change the name of the disk image from mac_hdd.img to something else, you’ll also have to update OpenCore-BS.sh to point to the new image name.

 

 

8. Now we can start the installation. But before we do, let’s edit the OpenCore-Boot.sh and add more RAM ( by default it’s set to use 3 gigs of RAM ). 8 gigs should be enough. At least Apple seems to think so.

You can do that with your favorite GUI text editor or from the terminal with nano, micro or vim.

 

 

9. Now you can start the installation process. Run ./OpenCore-BS.sh .

 

10. You’ll be greeted by this screen. Choose macOS Base System

 

 

10. First thing you’ll need to do is run Disk Utility and format your virtual drive.

 

 

11. Exit Disk Utility, choose Reinstall macOS and go through the usual installation steps.

 

 

12. During the installation process, your virtual machine will restart and will boot back up. When it does, choose macOS Installer to continue the installation.

 

13. After a loong time of installing, you will eventually be able to boot into your macOS installation.

 

You will be greeted with the welcome screen where you can set up your account and settings.

 

Don’t expect this to run just like a Mac. It’s a VM afterall. And it will feel sluggish mainly because there’s a lack of hardware acceleration. This can only be fixed by passing through a graphics card to the VM. To learn how to do that and other tips, and troubleshooting check out the official project on Github.