This script installs only open-source software and unmodified Apple binaries, and requires about 50GB of available storage, of which 25GB are for temporary installation files that may be deleted when the script is finished.
The script interacts with the virtual machine twice, please donot interact with the virtual machine manually before the script is finished.
Documentation about optional configuration, iCloud and iMessage connectivity, resuming the script by stages, and other topics can be viewed with the following command:
./macos-guest-virtualbox.sh documentation | less -R
Press enter to review the script configuration
vm_name="macOS" macOS_release_name="Catalina"# install "HighSierra" "Mojave" "Catalina" storage_size=80000# VM disk image size in MB. minimum 22000 storage_format="vdi"# VM disk image file format, "vdi" or "vmdk" cpu_count=4# VM CPU cores, minimum 2 memory_size=4096# VM RAM in MB, minimum 2048 gpu_vram=128# VM video RAM in MB, minimum 34, maximum 128 resolution="1280x800"# VM display resolution
These values may be customized as described in the documentation.
Press enter to continue, CTRL-C to exit
The command "VBoxManage list extpacks" either does not list the Oracle VM VirtualBox Extension Pack, or lists one or more extensions as unusable. The virtual machine will be configured without USB xHCI controllers.
Catalina selected to be downloaded and installed
stage: prompt_delete_existing_vm
stage: create_vm
stage: check_default_virtual_machine
Checking that VirtualBox starts the virtual machine without errors.
Checking that VirtualBox uses hardware-supported virtualization.
Splitting the several-GB InstallESDDmg.pkg into 1GB parts because VirtualBox hasn't implemented UDF/HFS VISO support yet and macOS doesn't support ISO 9660 Level 3with files larger than 2GB. 正在创建文件 'Catalina_InstallESD.part00' 正在创建文件 'Catalina_InstallESD.part01' 正在创建文件 'Catalina_InstallESD.part02' 正在创建文件 'Catalina_InstallESD.part03' 正在创建文件 'Catalina_InstallESD.part04' 正在创建文件 'Catalina_InstallESD.part05' 正在创建文件 'Catalina_InstallESD.part06' 正在创建文件 'Catalina_InstallESD.part07'
Downloading open-source APFS EFI drivers used for VirtualBox 6.0and5.2 ...even though VirtualBox version 6.1or higher is detected. AppleSupport-v2.0.4-RELEASE.zip 100%[===========================================================================================================================================>] 42.20K 269KB/s 用时 0.2s Archive: AppleSupport-v2.0.4-RELEASE.zip inflating: ApfsDriverLoader.efi inflating: AppleImageLoader.efi inflating: AppleUiSupport.efi
decompressing: opening partition 0 ... 100.00% ok opening partition 1 ... 100.00% ok opening partition 2 ... 100.00% ok opening partition 3 ... 100.00% ok opening partition 4 ... 100.00% ok opening partition 5 ... 100.00% ok opening partition 6 ... 100.00% ok opening partition 7 ... 100.00% ok
Archive successfully decompressed as Catalina_BaseSystem.img Converting from raw image file="Catalina_BaseSystem.img" to file="Catalina_BaseSystem.vdi"... Creating dynamic image with size 2138558464 bytes (2040MB)...
stage: create_bootable_installer_virtual_disk Creating Catalina installation media virtual disk image. 0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100% Medium created. UUID: 00a0e882-771d-4a9f-b2fb-9eebd21942dc
stage: populate_bootable_installer_virtual_disk
Creating VirtualBox 6 virtual ISO containing macOS Terminal script for partitioning and populating the bootable installer virtual disk.
Starting virtual machine "macOS". This should take a couple of minutes. If booting fails, exit the script by pressing CTRL-C then see the documentation for information about applying different CPU profiles in the section CPU profiles and CPUID settings.
Until the script completes, please donot manually interact with the virtual machine.
Press enter when the Language window is ready.^C
但无法启动,卡在了这里:
(进入vbox可以看到配置好的机器):
修复无法启动的问题
虚拟机无法启动,脚本打印出的提示,让修改cpuid(大概是因为宿主是AMD平台的原因):
1 2 3
This should take a couple of minutes. If booting fails, exit the script by pressing CTRL-C then see the documentation for information about applying different CPU profiles in the section CPU profiles and CPUID settings.
macOS does not supprort every CPU supported by VirtualBox. If the macOS Base System does not boot, try applying different CPU profiles tothe virtual machine withthe VBoxManage commands described below. First, whilethe VM is powered off, setthe guest's CPU profile to the host's CPU profile, then tryto boot the virtual machine: VBoxManage modifyvm "${vm_name}"--cpu-profile host VBoxManage modifyvm "${vm_name}"--cpuidremoveall If booting fails, try assigning eachofthe preconfigured CPU profiles while the VM is powered off withthe following command: VBoxManage modifyvm "${vm_name}"--cpu-profile "${cpu_profile}" Available CPU profiles: "Intel Xeon X5482 3.20GHz""Intel Core i7-2635QM""Intel Core i7-3960X" "Intel Core i5-3570""Intel Core i7-5600U""Intel Core i7-6700K"