[HowTo] Install OSX 10.13 in a VM

Discussions about using Mac OS X guests (on Apple hardware) in VirtualBox.
socratis
Site Moderator
Posts: 27329
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

[HowTo] Install OSX 10.13 in a VM

Post by socratis »

NOTE: The instructions to create an ISO from any OSX Install application are covered in another article.
Install OSX 10.13
  1. Create a new VM with the 10.13 template. Accept the defaults, with the exception of RAM (at least 3 GB), number of vCPUs (at least 2) and amount of HD (according to your needs, no less than 10 GB). Also make sure that USB3 controller is selected under the Ports » USB. Choose the newly created ISO as your boot medium.

    NOTE: Do NOT designate your virtual HD as an "SSD". The installation WILL fail if you do that, because the OSX installer will convert the filesystem to APFS, something that the VirtualBox EFI can not handle.
  2. Start the VM. It may seem that the installation stalls but don't shut the VM, be patient. Specifically, right before you switch to the graphics with the Apple logo and the progress bar, you'll get stuck at the point where the OSX ≥ 10.12.4 gets stuck:
    • IOConsoleUsers: gIOScreenLockState 3, hs 0, bs 0, now 0, sm 0x0
  3. After selecting the language, open "Disk Utility". For reasons that only Apple engineers understand, you will *not* see your hard drive! Instead you'll see a bunch of partitions that are of no interest to you whatsoever (see NOTE below). On the top-left side, click on the "View" drop-down and select "Show All Devices". Now you'll see your "VBOX HARDDISK Medium". Select it and choose "Erase" from the toolbar. Leave the defaults (HFS+J/GUID), except maybe the name, choose anything you like. Quit "Disk Utility" once done.

    NOTE: This "glitch" has been fixed with 10.13.2. Now the hard disk shows properly when Disk Utility is opened.
  4. Select "Install macOS". Continue and agree to the license. This will start a phase where the actual installer is copied to the Recovery Partition of the hard disk that you selected. That part is rather quick, lasting less than a couple of minutes on an SSD drive. After that your VM reboots. But, you won't re-boot into the OSX installation phase, you'll restart the whole installation again from scratch! Houston, we have a problem!!! If you're observant, you'll notice a quick message coming up, right before the VM boots again from the ISO to restart the whole installation process:
    • Boot Failed. Mac OS X
  5. Apple (another wise move) has modified the way that it reads/treats the different partitions in the EFI, something that currently VirtualBox cannot handle (as of 5.2.2). But, there is a solution. Once you find yourself up and running, right after the language selection step, shut down the VM and eject the 10.13 ISO that you booted from. Then boot the VM again. You get dropped in the EFI Shell.
  6. You need to keep resetting the VM (HostKey+R) and press any key until you get into the EFI menu screen. If you don't succeed, and you end up in the EFI shell, enter "exit". That will you get to the EFI menu, shown below:
    [attachment=2]EFImenu.png[/attachment]
  7. Select the "Boot Maintenance Manager" option, then "Boot from File". Now, you should have two options. The first one is your normal Boot partition, but this is not yet working, because you haven't yet installed 10.13. This is where the VM should be booting up from normally, and this is why it fails to boot. The second partition however is your Recovery partition. This is the one you should boot from to do the installation. This could be also used to do a re-installation of 10.13, just like on a real system, should the need arise.
    [attachment=1]BootFromFile.png[/attachment]
  8. Choose the second option, then "<macOS Install Data>", then "Locked Files", then "Boot Files", and finally "boot.efi" and let the games begin!
    [attachment=0]boot.efi.png[/attachment]
  9. That second part of the installation is where 10.13 actually gets installed. This is going to take substantially more time, about 20-30 min with the VM consuming every available CPU cycle. The VM will reboot a couple of times but you should be all set.
PS: There is also another guide, which I discovered after I wrote this guide, that contains some pretty pics in case you get confused by the text-only instructions: http://tobiwashere.de/2017/10/virtualbo ... st-system/
Attachments
boot.efi.png
boot.efi.png (23.36 KiB) Viewed 211065 times
BootFromFile.png
BootFromFile.png (48.02 KiB) Viewed 211065 times
EFImenu.png
EFImenu.png (32.71 KiB) Viewed 211065 times
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
dbourne
Posts: 8
Joined: 25. Nov 2017, 06:25
Primary OS: Mac OS X other
VBox Version: OSE other
Guest OSses: macOS High Sierra
Location: Colorado

Re: [HowTo] Install OSX 10.13 in a VM

Post by dbourne »

Thank you the information but I'm not getting very far...

I'm logged into the computer as a normal user. In terminal I logged in as the admin. I copied your script and created the .iso file. I copied it to the /Shared folder and from there copied it onto the Desktop of the normal user.

I created a new VM with RAM 8192, HD 50 and CPUs 2. (Also display 128). I attached the .iso file to the first SATA CD and deleted the floppy option in the System:Motherboard pane. This should cause the ISO to be the boot medium?

Blank black screen. 1:06

I'm not seeing
IOConsoleUsers: gIOScreenLockState 3, hs 0, bs 0, now 0, sm 0x0
or VBOX HARDDISK Medium in Disk Utilities
ChipMcK
Volunteer
Posts: 1095
Joined: 20. May 2009, 02:17
Primary OS: Mac OS X other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows, OSX
Location: U S of A

Re: [HowTo] Install OSX 10.13 in a VM

Post by ChipMcK »

Screen image
Screen image
VirtualBox_HighSierra-1_25_11_2017_16_38_59.png (32.22 KiB) Viewed 211049 times
Seems to have hung for me
Attachments
HighSierra-1.vbox.zip
recipe
(1.51 KiB) Downloaded 2111 times
HighSierra-1-2017-11-25-16-42-22.log.zip
Log file
(25.95 KiB) Downloaded 1481 times
socratis
Site Moderator
Posts: 27329
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: [HowTo] Install OSX 10.13 in a VM

Post by socratis »

ChipMcK, I imported your .vbox and changed only the VDI and the ISO (obviously). It booted just fine.
  • You have 1595 MB available, not a good sign if you want to dedicate 2048 MB.
  • You have 2 CPUs, both of them assigned to the VM. Which it needs it BTW.
  • I don't know what '/Volumes/Mac_Card-2' is, but if it's USB3, or not your local SSD you have to waaaaaaiiiiiiitttttt...
  • You got stuck during the USB initialization phase. Try to switch to xHCI, aka USB3, although I highly doubt that this is the reason. That was the last step, there is plenty of I/O after that which is what might slow you down.
  • Keep the ActivityMonitor open at the Disk I/O tab to monitor what's going on
Your MacBookAir is not that powerful to begin with. It will at the low end minimum side to run 10.13 standalone, imagine in a VM. Expect delays...
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
socratis
Site Moderator
Posts: 27329
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: [HowTo] Install OSX 10.13 in a VM

Post by socratis »

dbourne wrote:Blank black screen. 1:06
1:06??? That's it??? That's nothing. Nobody said anything about this thing being fast, on the contrary. Please do as ChipMcK did and attach a VBox.log and the .vbox file, ZIPPED BOTH OF THEM. You can find them by right-clicking in the VM, Show log (VBox.log), and by right-clicking, Show in Finder (.vbox file).
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
ChipMcK
Volunteer
Posts: 1095
Joined: 20. May 2009, 02:17
Primary OS: Mac OS X other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows, OSX
Location: U S of A

Re: [HowTo] Install OSX 10.13 in a VM

Post by ChipMcK »

what is with i/o errors for disk1s3?

The "createinstallmedia" is normally used to an USB image, not an ISO.
Would it be appropriate to attach an HD/vdi instead of CD?

this meant as a feasibility test
dbourne
Posts: 8
Joined: 25. Nov 2017, 06:25
Primary OS: Mac OS X other
VBox Version: OSE other
Guest OSses: macOS High Sierra
Location: Colorado

Re: [HowTo] Install OSX 10.13 in a VM

Post by dbourne »

Sorry about the 1:06. That was the time when I started the VM. I meant to delete that or at least give an idea of how long I let it run. Maybe an hour or more.

Here are the files from a new run of VM. Thanks for your help.
Attachments
Archive.zip
Vbox.log and High Sierra.vbox
(29.4 KiB) Downloaded 1407 times
socratis
Site Moderator
Posts: 27329
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: [HowTo] Install OSX 10.13 in a VM

Post by socratis »

@ChipMcK
ChipMcK wrote:what is with i/o errors for disk1s3?
What errors? Where did you see that?
ChipMcK wrote:The "createinstallmedia" is normally used to an USB image, not an ISO.
This method/script overall creates an ISO. Take a look at the steps in the script, mainly the "hdiutil convert ...". That's what's converting your bootable "USB" into an ISO.
ChipMcK wrote:Would it be appropriate to attach an HD/vdi instead of CD?
Nope, because you have a valid ISO image. Plus you do boot up, don't you? That's not your problem, your problem is the performance. Patience my young padawan...;)


@dbourne
Your logs look perfectly normal, up to one point right after your EFI is loaded, at almost the 5" mark (mine was at 7"):
00:00:04.953960 IEM: rdmsr(0x35) -> #GP(0)
Now this doesn't look good. IEM is the "instruction interpreter" part of VirtualBox. There is a chance that with your processor (i7-7700K@4.20GHz) VirtualBox doesn't know how to handle that instruction (rdmsr) at that stage. I don't think there's a lot you can do at this point, except either file a bug report, or wait until Monday till the developers get in.

Except... one last thing to try. With the VM shutdown, open up Terminal and issue the command:
  • VBoxManage modifyvm "High Sierra" --cpu-profile "Intel Core i7-6700K"
That will force VirtualBox to present a different, older CPU than the one you have. It's worth a shot, it might work. But don't hold your breath...
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
dbourne
Posts: 8
Joined: 25. Nov 2017, 06:25
Primary OS: Mac OS X other
VBox Version: OSE other
Guest OSses: macOS High Sierra
Location: Colorado

Re: [HowTo] Install OSX 10.13 in a VM

Post by dbourne »

@scocratis

I issued the command
VBoxManage modifyvm "High Sierra" --cpu-profile "Intel Core i7-6700K"
and made some progress. I got as far as installing High Sierra from what looked like the Restore disk. (Still nothing has shown up in Disk Utility). I'll attach some screen shots and logs.

Thanks for your help, db

PS, screen shots are too big. I'll try attaching to another message.
Attachments
Archive.zip
logs and High Sierra.vbox
(123.79 KiB) Downloaded 1270 times
dbourne
Posts: 8
Joined: 25. Nov 2017, 06:25
Primary OS: Mac OS X other
VBox Version: OSE other
Guest OSses: macOS High Sierra
Location: Colorado

Re: [HowTo] Install OSX 10.13 in a VM

Post by dbourne »

Looks like they are still too big. I'll try uploading some tomorrow if needed.
socratis
Site Moderator
Posts: 27329
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: [HowTo] Install OSX 10.13 in a VM

Post by socratis »

General rule: resize/shrink them. Actually, if you're on a HiDPI, that's a must. So, shrink them down by at least 50% or 75% if not more.

Why do I need a picture? A picture of what? It seems that you made progress and installed it. Your HD doesn't show immediately, you have to take some steps. Did you read the instructions about the drop-down menu in DiskUtility? Please re-read the steps.
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
dbourne
Posts: 8
Joined: 25. Nov 2017, 06:25
Primary OS: Mac OS X other
VBox Version: OSE other
Guest OSses: macOS High Sierra
Location: Colorado

Re: [HowTo] Install OSX 10.13 in a VM

Post by dbourne »

@socratis

It worked!!! After multiple tries with different results I didn't recognize a key instruction. Open Disk Utilities means open Disk Utilities in the Guest VM :-)

Thanks, db

===

I've adjusted your instructions slightly to highlight the bits I got lost on. Thanks for all your help. I'll include the adjusted text below. My changes/suggestions in [ ]
---
a) Download "Install macOS High Sierra.app" from Apple. By default it will be placed in the "/Applications" folder.

[when you cancel the install process the .app file won't be deleted]
...

NOTE: The script will not work if you are a Standard user. You have to be an Administrator in order for the "sudo" to work, since Standard users cannot sudo. If you are a Standard user, first do a "su Administrator" before running the script.

[If you login into the admin account the iso file will end on on the admin Desktop. You can move/copy this to the user account via the /Shared folder. Also note the size change in the first command]
...

a) Create a new VM with the 10.13 template. Accept the defaults, with the exception of RAM

[4096+], number of vCPUs

[2+], amount of HD

[40+], display memory

[128]. Choose the newly created ISO as your boot medium.

[Quit VirtualBox and issue the command (iMac 27" 2017)
VBoxManage modifyvm "High Sierra" --cpu-profile "Intel Core i7-6700K"
from the terminal]
...

b) Start the VM. It may seem that the installation stalls but don't shut the VM, be patient. Specifically, right before

[after] you switch to the graphics with the Apple logo and the progress bar, you'll get stuck at the point where the OSX ≥ 10.12.4 gets stuck:

IOConsoleUsers: gIOScreenLockState 3, hs 0, bs 0, now 0, sm 0x0 [I didn't notice this]
socratis
Site Moderator
Posts: 27329
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: [HowTo] Install OSX 10.13 in a VM

Post by socratis »

Glad you got it going! Of course the instructions talk about the VM, once the installation has started. ;)
  1. I added a "Cancel the 10.13 installation". Thanks for the tip, I thought that you didn't want to upgrade the host and you'd cancel out, that's why I didn't include it.
  2. You have a huge, fast system. Not everyone does. You can increase the minimum offered from the template at will. But let's keep the recipe as per the defaults.
  3. The --cpu-profile is a *very* specific instruction that applies *only* to your system. It's a workaround until VirtualBox fixes it. Otherwise it's going to end up like every other outdated blog out there that proposes blindly the --cpuid modification. Not what you want.
  4. You didn't "see" the message because you have a monster of a host and it flew over. The message *is* there, trust me ;)
For me the most important lesson from your setup was the --cpu-profile and the fact that it made it work. Again, glad you're up and running!
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
dbourne
Posts: 8
Joined: 25. Nov 2017, 06:25
Primary OS: Mac OS X other
VBox Version: OSE other
Guest OSses: macOS High Sierra
Location: Colorado

Re: [HowTo] Install OSX 10.13 in a VM

Post by dbourne »

@socratis

I had tried a few things with various results so when I started to see the Recovery Partition window in the VM with the choice of Installing the System I went down the rabbit hole.

b) I picked up some of the potential template increases from somewhere in my travels, maybe another thread on this forum even. One that seemed to be stressed was increasing the display memory to the max (128). I tried 4 CPUs but that stressed my machine a 'little' with the fans running hot so I've dropped back to 2 for now ;-)
c) Well done with the --cpu-profile that made it work. Thanks.
d) There is a lot of 'stuff' on the screen...I trust you.

My plan is to use the macOS guest to explore some debugging techniques (from a book - I'm just learning) which seems to require disabling System Integrity Protection. As suggested in the book I plan to do much of this in the VirtualBox guest VM.

Thanks again for you help. Your instructions worked as written (with the --cpu-profile addition for my machine).
Darth Vader
Posts: 17
Joined: 13. Dec 2017, 03:12

Re: [HowTo] Install OSX 10.13 in a VM

Post by Darth Vader »

Continued from here: viewtopic.php?f=22&t=85915

What if I changed to the normal boot option, how would i do that?
Locked