Running macOS Mojave 10.14 on VirtualBox 5.2.18 on Linux x86_64

Short entry here, since it was covered in the early article how to setup the Mojave-Beta in VirtualBox and Apple released the stable Mojave yesterday.  Maybe somebody will find it useful.

We will download the Mojave dmg via AppleStore from the Mojave-Beta VBox guest that we installed earlier  ( you can download the ready made ISO from here https://drop.me/oj2GJl )

Without actually installing it, after download is finished we run the following sets of commands to create the Mojave.iso

hdiutil create -o /tmp/Mojave.cdr -size 6000m -layout SPUD -fs HFS+J
hdiutil attach /tmp/Mojave.cdr.dmg -noverify -mountpoint /Volumes/install_build
sudo /Applications/Install\ macOS\ Mojave.app/Contents/Resources/createinstallmedia --volume /Volumes/install_build
mv /tmp/Mojave.cdr.dmg ~/Desktop/
hdiutil detach /Volumes/Install\ macOS\ Mojave/
hdiutil convert ~/Desktop/Mojave.cdr.dmg -format UDTO -o ~/Desktop/Mojave.iso

Next we upload the Mojave.iso to our Linux host and continue with the standard macOS VirtualBox setup  (In the first stage attach Mojave.iso – clover.iso will be in the second one)

You can download the macOS Mojave from here https://drop.me/oj2GJl

Before we run the VM make sure you execute the following script to setup VirtualBox for macOS – replace the NAME variable with the name of the VirtualBox guest name.

#!/bin/bash
readonly VM_RES="1680x1050"
readonly NAME="Mojave"

VBoxManage modifyvm "$NAME" --usbxhci on --firmware efi --chipset ich9 --mouse usbtablet --keyboard usb
VBoxManage setextradata "$NAME" "CustomVideoMode1" "${VM_RES}x32"
VBoxManage setextradata "$NAME" VBoxInternal2/EfiGraphicsResolution "$VM_RES"
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

Also the following networking script is used (adjust accordingly) for the following network config in VirtualBox

If you don’t care about virtual VLANs you can just use the default NAT and choose DHCP in macOS install

#Setup tap and bridge 
tunctl -t tap0 -u user
ifconfig tap0 up
brctl addbr br0
brctl addif br0 enp0s25 vboxnet0 
brctl setfd br0 0
ifconfig enp0s25 10.0.2.1 up 
ifconfig br0 10.0.2.2 netmask 255.255.255.0 broadcast 10.0.2.255 up
brctl addif br0 tap0 vboxnet0 
ifconfig tap0 0.0.0.0
sysctl net.ipv4.ip_forward=1
iptables -A FORWARD --in-interface enp0s25 -j ACCEPT
iptables --table nat -A POSTROUTING --out-interface wlp9s0 -j MASQUERADE

Next we go on with the normal Mojave.iso boot

Once we get to the first setup screen “erase” disk with APFS and start the installation – don’t worry that VirtualBox does not understand APFS partitions in UEFI, we have the custom Clover.iso loader for that during 2nd stage install.

Once the 1st stage installer finishes, it will reboot and you will endup yet again in the same setup window, since we did not switch the ISO, so just terminate the macOS guest and swap the Mojave.iso with Clover.iso

you can download Clover.iso with APFS support here https://drop.me/MRqW76

Boot again the guest VM and in Clover menu choose the Boot macOS Install from Mojave (Name of the disk I have chosen during 1st stage setup)  (move the arrow keys to navigate Clover menu)

Next we continue with the standard setup

After it finishes, it will reboot but will get stuck in the following screen, so just hard reset here no problem

Boot again with the Clover.iso still attached (we will use Clover to load macOS) and choose Boot macOS from Mojave (use the arrow keys to navigate Clover menu)

Next we configure network (adjust accordingly)

And welcome to your new macOS 10.14 Mojave !

A small security note here. If you need to enable SIP in your virtuallized Mojave, you need to modify the following configuration file in the Clover.iso

efi/clover/config.plist

There is an option that sets CsrActiveConfig as below

CsrActiveConfig
0x67

You will need to change it to match what you want -> 0x0

csr-active-config 0x0 = SIP Enabled (Default)
csr-active-config 0x3 = SIP Partially Disabled (Loads unsigned kexts)
csr-active-config 0x67 = SIP Disabled completely

 

Advertisements

About astr0baby

Please run Adblock or similar... we have been told to do so since Carl Sagan wrote the Contact .
Gallery | This entry was posted in Uncategorized. Bookmark the permalink.

87 Responses to Running macOS Mojave 10.14 on VirtualBox 5.2.18 on Linux x86_64

  1. Hi,
    Thanks! How is the performance?

    • astr0baby says:

      Quite fast, ( running on SSD seems almost native)

      • Boyan says:

        First of all, thank you very much for the guide! I was able to succesfully boot MacOS Mojave thanks to it.

        Could you please define quite fast? Loading times seem okay for me, however animations are extremely choppy and slow. I’m wondering whether it’s something on my side? I’ve changed the CPU cores to 4 and the VRAM to the max 128MB (although I have 4GB VRAM in total on my nVidia GPU they are not available in the settings)

      • astr0baby says:

        For me fast means general Safari usage, work in terminal, mounting remote shares etc .. I only test security related things, no graphical
        performance in the VM, thus quite fast.

  2. Hangs on the first installation screen (choose language). No mouse, no keyboard …. Any idea?

  3. r says:

    where to download clover.iso

  4. Gavin Dundee says:

    For some reason the clover.iso will not boot.. I am running Ubuntu 18.04 with the latest version of Virtualbox installed. Does anyone have any idea why this will not boot?

  5. Alex says:

    Booting from clover into Mac OS install after the first stage just gives a bunch of weird video artifacts and stops there. Intel CPU.

    • astr0baby says:

      Did you configure the Guest VM properly prior running ? It is essential to run the following before booting the Clover/macOS

      change the NAME variable according to your naming convention and keep the VM_RES=”1680×1050″ otherwise you will get artefacts.

      #!/bin/bash
      readonly VM_RES=”1680×1050″
      readonly NAME=”Mojave”

      VBoxManage modifyvm “$NAME” –usbxhci on –firmware efi –chipset ich9 –mouse usbtablet –keyboard usb
      VBoxManage setextradata “$NAME” “CustomVideoMode1” “${VM_RES}x32”
      VBoxManage setextradata “$NAME” VBoxInternal2/EfiGraphicsResolution “$VM_RES”
      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

    • manner says:

      Resolution seems to be set by the clover boot manager, macOS seems to not change it afterwards, so you need to ensure to at least have the same width set to virtual machine and clover config. You can change the resolution clover sets in its config.plist file (search for key ScreenResolution) and you need to set the same with the VBoxManage commands for the vm.

  6. manner says:

    Can I disable clover to not show its ui but boot automatically? Seems that changing the “Timeout” key in config.plist has no effect, the ui pops up with unlimited timeout anyway.

  7. Did you have trouble running some of the applications? For example, I had High Sierra and I wasn’t able to generate slideshow from the Photos app. Just want to see if you are having the same issue. Thanks!

  8. Sebastian says:

    Hi,

    I tried to install Mac OS Mojave on my VMWare server created by virtual box and managed by phpvirtualbox. If I try to boot the setup the screen went in to hieroglyphics (see picture link).

    Do you or someone have the same problem and know a solutio?

    thx

    Sebastian

    • astr0baby says:

      You must use the exact screen resolution in the VB guest like this
      #!/bin/bash
      readonly VM_RES=”1680×1050″
      readonly NAME=”Mojave”

      VBoxManage modifyvm “$NAME” –usbxhci on –firmware efi –chipset ich9 –mouse usbtablet –keyboard usb
      VBoxManage setextradata “$NAME” “CustomVideoMode1” “${VM_RES}x32”
      VBoxManage setextradata “$NAME” VBoxInternal2/EfiGraphicsResolution “$VM_RES”
      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”

      The 1680×1050 is hardcoded on the clover.iso in the configuration. If you want to change it you must modify the clover.iso clover/config.plist

  9. Varun Agraw says:

    Hey!! The link to clover.iso is broken. Please give me the new link!! :/.

    Thanks

  10. Manuel says:

    What is owl in finder network?

    • astr0baby says:

      Sorry I don’t fully understand …

      • Manuel says:

        When I open a Finder and select Network, It show a machine named owl “búho in spanish”. This system isn’t in my network.
        Tks

      • astr0baby says:

        I have no idea how your “network” is configured. If there is something on it that you don’t recognize then you have a problem. Why do you ask here about it ? Again let me repeat here one more time – the macOS images are vanillas from Apple Store..

  11. Adam F says:

    How to set screen resolution on with Linux host:

    Use VBoxManage setextradata $MOJAVEVM VBoxInternal2/EfiGraphicsResolution 1920×1080

    You also have to set the resolution in EFI/CLOVER/config.plist (in the Clover .iso). Unfortunately, this is hard to do in Linux because ISO9660 partitions are meant to be read only and most editing methods end up destroying important EFI data. (I have no idea how to build Clover from scratch.) I came up with another solution: building an editable Clover disk image that you can attach to the VM instead of Clover.iso.

    This is pretty easy to replicate once you know how:
    # Make an empty file big enough to hold an EFI partition*:
    dd if=/dev/zero of=clover.raw count=1 bs=100M
    # Create an EFI type partition
    echo “,,ef,” | sfdisk clover.raw
    # Mount the raw file as a device (you need qemu for this)
    sudo modprobe nbd
    sudo qemu-nbd -c /dev/nbd1 -f raw clover.raw
    # Format the partition as FAT32
    sudo mkfs.fat -F32 /dev/nbd1p1
    # Mount the newly created partition
    mkdir efi
    sudo mount /dev/nbd1p1 efi

    So you’ve now got a pristine empty EFI environment. Now just copy all the files from Clover.iso into it, and edit the config.plist as described previously. Then build the disk image:

    sudo umount efi
    sudo qemu-img convert clover.raw -O vmdk clover.vmdk

    And just boot the Mojave vm off of clover.vmdk and you’re home free!

    Here’s my 1080p clover.vmdk in case anyone else wants it: https://ipfs.eternum.io/ipfs/QmWzYjrtNpZenRu3dk6NDuLrJV8LY9WsFq8AWqKfhyBspm

    * Supposedly EFI partitions can’t be smaller than 100MB, and the Arch wiki recommends 512MB, but I successfully created one in a 35MB file. Since they get compressed in the vmdk it shouldn’t make much difference.

  12. I get empty screen after installing macOS during booting from clover.iso
    Version 5.2.20 r125813 (Qt5.6.2)
    Any ideas how to fix?

    • astr0baby says:

      You must use the exact screen resolution in the VB guest like this
      #!/bin/bash
      readonly VM_RES=”1680×1050″
      readonly NAME=”Mojave”

      VBoxManage modifyvm “$NAME” –usbxhci on –firmware efi –chipset ich9 –mouse usbtablet –keyboard usb
      VBoxManage setextradata “$NAME” “CustomVideoMode1” “${VM_RES}x32”
      VBoxManage setextradata “$NAME” VBoxInternal2/EfiGraphicsResolution “$VM_RES”
      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”

      The 1680×1050 is hardcoded on the clover.iso in the configuration. If you want to change it you must modify the clover.iso clover/config.plist

  13. unicorn says:

    Hi when I first boot downloaded Mojave iso in VB I get stuck at “End RandomSeed” just like this guy: https://www.reddit.com/r/virtualbox/comments/9l0utg/stuck_on_end_randomseed_virtualbox_macos_mojave/
    Can you help? I am on Manjaro Linux.

  14. unicorn says:

    Here is config

  15. user1 says:

    I’m getting a “command not found” error when running the below command:

    “`
    attach /tmp/Mojave.cdr.dmg -noverify -mountpoint /Volumes/install_build
    -bash: attach: command not found
    “`

  16. user1 says:

    This command:

    hdiutil convert ~/Desktop/Mojave.cdr.dmg -format UDTO -o ~/Desktop/Mojave.iso

    It created a “Mojave.iso.cdr file on my desktop. Is this normal? Should I change the file extension to .iso or will VirtualBox be able to import it no matter the file extension?

  17. SIP says:

    After successfully installing Mojave in Virtualbox, it seems SIP isn’t enabled? You can verify this by using `sudo csrutil status` in a Terminal. Is this a side effect of using macOS in VM? I tried enabling it in recovery mode but it doesn’t work. Thoughts?.

  18. SIP says:

    Thanks, “csr-active-config 0x0 = SIP Enabled (Default)” seemed to work. How did you figure out that was the reason?

    • astr0baby says:

      I have just searched the Clover.iso master config file that would possibly be the problematic part. BTW I have updated the blogpost on Mojave to make sure people who need this can set it up accordingly. Thanks again for noticing this ;)

  19. Jess says:

    Heads up to anyone with mouse probs:

    These two links should help:

    https://superuser.com/questions/956622/no-usb-devices-available-in-virtualbox

    https://www.wikigain.com/fix-mouse-keyboard-stuck-macos-mojave-virtualbox/

    There were Linux group/perms issues involved, and while I’d downloaded the extension pack, I hadn’t added any devices.

  20. Rick says:

    The machine boots fine but I cannot see any of my USB drives connected. Even if I add them to the USB filters and VBox see them. The drive does not appear in Mojave. I also have no sound output. Any idea on what to do?

  21. thank you. It works works very well. What i have to do, to update 10.14 |–> 10.14.1

    • astr0baby says:

      Just run the macos updater and once the system reboots (you might have to force shutdown it in the console because it can get stuck) you need to load the macos-installer partition in clover, then wait till it finishes, reboot and load macos via clover normally. It works.

  22. Dr. Fred Albrecht says:

    thank you. It works perfekt.

  23. Benjamin says:

    Thanks a lot astr0baby! Very nice tutorial with all the bells and whistles

  24. Nico says:

    Hi, I get a black screen when I boot after swapping the Mojave.iso with Clover.iso

    • astr0baby says:

      Did you set the screen parameters correctly for your Mojave VM ?
      #!/bin/bash
      readonly VM_RES=”1680×1050″
      readonly NAME=”Mojave”

      VBoxManage modifyvm “$NAME” –usbxhci on –firmware efi –chipset ich9 –mouse usbtablet –keyboard usb
      VBoxManage setextradata “$NAME” “CustomVideoMode1” “${VM_RES}x32”
      VBoxManage setextradata “$NAME” VBoxInternal2/EfiGraphicsResolution “$VM_RES”
      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

  25. Nilo Coelho Junior says:

    Thanks! It’s work for me

  26. Pingback: Valuable News – 2018/12/08 | 𝚟𝚎𝚛𝚖𝚊𝚍𝚎𝚗

  27. Eby says:

    Just in case anyone has similar issues, I’ll put these together as they are scattered around comments. I’m on a Lenovo laptop.

    – I was installing from USB and you need the VirtualBox extension pack for USB devices to be available
    – If you have a black screen on clover boot make sure OSX High Sierra is your box setting. I had OSX 64 bit generic which some other screenshots/tutorials showed.
    – If no keyboard/mouse interaction with the installer recreate the VM and rerun the script. I’m not sure if turning on the VM before the script causes something or if creating it before the extension pack was an issue but doing a fresh box with the script before running it fixed the issue.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.