myspaghetti / macos-virtualbox

Push-button installer of macOS Catalina, Mojave, and High Sierra guests in Virtualbox on x86 CPUs for Windows, Linux, and macOS
GNU General Public License v2.0
13.46k stars 1.11k forks source link

macOS 12 Monterey and macOS 11 Big Sur #547

Closed myspaghetti closed 4 months ago

myspaghetti commented 2 years ago

The issue with installing macOS 12 Monterey is almost identical to issue #254 regarding installing macOS 11 Big Sur.

Apple packaged the file structure of the bootable installer in a xar archive (more accurately a pkg archive), so unpacking the installer for Big Sur and Monterey requires a xar-supporting archiver. This is available on macOS but rarely available as a binary package on other operating systems. Compiling the free and open-source xar is not difficult, but requiring compilation will impose many more dependencies on the script.

People familiar with compiling software can easily compile xar and use it to create a bootable installer from InstallAssistant.pkg the same way the script does. Meanwhile people who don't want to compile software can use the script to install earlier versions of macOS and use Software Update to create bootable installers of Monterey and Big Sur.

@rhoehener suggested using an existing macOS VM to create a Big Sur bootable installer, which would work all the same on Monterey and as an upgrade as well as a bootable installer.

This would work, and I think it's better to have it as a separate script which can be daisy-chained from this script if desired or applied to an existing macOS VM.

Currently I don't plan on implementing this, but it shouldn't be more or less straightforward to use tesseract similar to how it's used in the current script to detect the macOS VM state according to on-screen text and send the appropriate keystrokes.

Others have suggested using 7zip; it does not correctly extract this type of xar archives. Others have suggested using Docker; Docker on Windows uses Hyper-V and in general cannot be run concurrently with a VirtualBox macOS guest.

I deleted the previous issue (#476) to avoid the Google results that lead people to post about general issues with Docker and macOS here.

haphaeu commented 2 years ago

I'm willing to give it a try to a xar dependent fork of this project, for the people that want to compile xar themselves. Unless someone has already done that?

I'm however stuck where to find URLs for the sucatalogs for Big Sur and Monterey?

myspaghetti commented 2 years ago

Simple - they're found on working systems with Big Sur and Monterey! 😉

Big Sur software update catalog URL: https://swscan.apple.com/content/catalogs/others/index-11-10.15-10.14-10.13-10.12-10.11-10.10-10.9-mountainlion-lion-snowleopard-leopard.merged-1.sucatalog

Monterey software update catalog URL: https://swscan.apple.com/content/catalogs/others/index-12-10.16-10.15-10.14-10.13-10.12-10.11-10.10-10.9-mountainlion-lion-snowleopard-leopard.merged-1.sucatalog

thispsj commented 2 years ago

Hi @myspaghetti ,

I read in #254 about 7zip. You said that it's only able to extract a single payload file.

I just wanted to let you know that 7zip can also extract the payload. I have attached a clip below for the same. Let me know if I am wrong 😅

!Payload Extraction

myspaghetti commented 2 years ago

Oh nice, I never thought of trying to extract Payload~

thispsj commented 2 years ago

Oh nice, I never thought of trying to extract Payload~

I know this from the time I installed Big Sur the last year but had never read all of #254 :sweat_smile: .

nmonti commented 2 years ago

I initially ran into an infinite boot loop on upgrading from Catalina to Monterey using System Update. This solution on #484 worked for me courtesy of FlorianLeMenn: https://github.com/myspaghetti/macos-virtualbox/issues/484#issuecomment-1074848640.

TLDR in the host, with the macOS vm off:

VBoxManage setextradata "macos" "VBoxInternal/Devices/smc/0/Config/GetKeyFromRealSMC" 1
VBoxManage setextradata "macos" "VBoxInternal/TM/TSCMode" "RealTSCOffset"

You don't need a fresh Catalina install to fix the boot loop. Stop the VM, run those commands, and it should complete the upgrade.

Note that the script sets GetRealFromSMC to 0 https://github.com/myspaghetti/macos-virtualbox/blob/master/macos-guest-virtualbox.sh#L753. It must remain 1 after Monterey is installed.

thispsj commented 2 years ago

I initially ran into an infinite boot loop on upgrading from Catalina to Monterey using System Update. This solution on #484 worked for me courtesy of FlorianLeMenn: #484 (comment).

TLDR in the host, with the macOS vm off:

VBoxManage setextradata "macos" "VBoxInternal/Devices/smc/0/Config/GetKeyFromRealSMC" 1
VBoxManage setextradata "macos" "VBoxInternal/TM/TSCMode" "RealTSCOffset"

You don't need a fresh Catalina install to fix the boot loop. Stop the VM, run those commands, and it should complete the upgrade.

Note that the script sets GetRealFromSMC to 0 https://github.com/myspaghetti/macos-virtualbox/blob/master/macos-guest-virtualbox.sh#L753. It must remain 1 after Monterey is installed.

@nmonti you're absolutely right. Even I was facing the same issue but it took me 2 days before I could figure out the problem.

Putting this here will ensure that others don't have to waste so much of time like me😅

R3D347HR4Y commented 2 years ago

@nmonti Your solution worked and Monterey is currently working on my VM, there is one issue however: My Display memory is at 7MB and graphical performance is insanely slow, tried installing VBox GAs and the install failed... Tried with the VMWare ones and it doesn't change anything from what I can see... I'll dial down the resolution for the time being but I'd like to know if someone found a solution to get better graphical performance on Monterey image

EDIT: I got the video memory to be recognized by installing the VMWare Tools, then using those commands on the host computer (with the guest turned off)

VBoxManage setextradata "VBoxNAME" VBoxInternal2/EfiGraphicsResolution "1920x1080"
VBoxManage modifyvm "VBoxNAME" --vram 256

I then changed the Graphics Controller setting in VirtualBox to VMSVGA (do it in the settings preview pane and not in the settings of the machine, it reverts for some reason) You'll need to run this command at every login to make sure the resolution is corrrect btw:

echo "your mac password" | sudo -S /Library/Application\ Support/VMware\ Tools/vmware-resolutionset 1920 1080

You can automate it as shown in this video: https://www.youtube.com/watch?v=gDwFdGUsBOo Performance is still sluggish though that might be CPU driven, will try to change the CPU ID

nmonti commented 2 years ago

From my understanding macOS uses way more graphical power than other OSes. In addition, VMs aren't great with graphics and GPU passthrough is still seemingly in infancy. I was fiddling around and couldnt get it to be smooth despite jacking my VM settings up, but I'd love to know if there are any tricks!

On May 6, 2022, at 1:56 AM, R3D347HR4Y @.***> wrote:

 @nmonti Your solution worked and Monterey is currently working on my VM, there is one issue however: My Display memory is at 7MB and graphical performance is insanely slow, tried installing VBox GAs and the install failed... Tried with the VMWare ones and it doesn't change anything from what I can see... I'll dial down the resolution for the time being but I'd like to know if someone found a solution to get better graphical performance on Monterey

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.

myspaghetti commented 2 years ago

The best solution by far is to use QEMU/KVM instead of VirtualBox.

leiless commented 2 years ago

The best solution by far is to use QEMU/KVM instead of VirtualBox.

Hi, @myspaghetti. How can I run macOS 11/12 in QEMU/KVM under a Linux host? is there any documentation?

myspaghetti commented 2 years ago

There's a very nice tutorial by Nicholas Sherlock. You can export an existing VirtualBox image instead of creating a new installation. You can install OpenCore on the existing image or on a separate image. QEMU/KVM also works surprisingly well on Windows through WSL2 or WSLg, you don't even need to compile any kernel modules, it works out of the box (test with kvm-ok).

REVENGE977 commented 1 year ago

There's a very nice tutorial by Nicholas Sherlock. You can export an existing VirtualBox image instead of creating a new installation. You can install OpenCore on the existing image or on a separate image. QEMU/KVM also works surprisingly well on Windows through WSL2 or WSLg, you don't even need to compile any kernel modules, it works out of the box (test with kvm-ok).

wait so you can make a macos kvm on wsl2 ? will it run as smoothly as a normal kvm ?

mr-gosh commented 1 year ago

I just did the updates via system upgrade up to Monterey - worked like a charm.

Not testing Ventura for now.

duyleekun commented 1 year ago

The script works with minor modifications to install from internet recovery. You can always duplicate/snapshot machines so keeping the file for reusing later won't be useful I suppose. Monterey worked without updating from catalina

Tim-Cao commented 10 months ago

VBoxManage setextradata "macos" "VBoxInternal/Devices/smc/0/Config/GetKeyFromRealSMC" 1 VBoxManage setextradata "macos" "VBoxInternal/TM/TSCMode" "RealTSCOffset" This way doesn't work with upgrade to Ventura image

BrianHotopp commented 6 months ago

I initially ran into an infinite boot loop on upgrading from Catalina to Monterey using System Update. This solution on #484 worked for me courtesy of FlorianLeMenn: #484 (comment). TLDR in the host, with the macOS vm off:

VBoxManage setextradata "macos" "VBoxInternal/Devices/smc/0/Config/GetKeyFromRealSMC" 1
VBoxManage setextradata "macos" "VBoxInternal/TM/TSCMode" "RealTSCOffset"

You don't need a fresh Catalina install to fix the boot loop. Stop the VM, run those commands, and it should complete the upgrade. Note that the script sets GetRealFromSMC to 0 https://github.com/myspaghetti/macos-virtualbox/blob/master/macos-guest-virtualbox.sh#L753. It must remain 1 after Monterey is installed.

@nmonti you're absolutely right. Even I was facing the same issue but it took me 2 days before I could figure out the problem.

Putting this here will ensure that others don't have to waste so much of time like me😅

legend - this worked for me