macos-virtualbox README

The project's README from github.com/myspaghetti/macos-virtualbox. As one markdown file: README.md.

macOS inside a VirtualBox window with the dock positioned on the left

Push-button installer of macOS on VirtualBox

macos-guest-virtualbox.sh is a Bash script that creates a macOS virtual machine guest on VirtualBox with unmodified macOS installation files downloaded directly from Apple servers.

A default install only requires the user to sit patiently and, less than ten times, press enter when prompted by the script, without interacting with the virtual machine.

Tested on bash and zsh on Cygwin. Works on macOS, CentOS 7, and Windows on x86 CPUs with VT-x or AMD-V. Should work on most modern Linux distros.

macOS Catalina (10.15), Mojave (10.14), and High Sierra (10.13) currently supported.

Maintainer wanted

If you would like to become the maintainer of this repository, please see issue #645 - maintainer wanted.

Documentation

Documentation can be viewed by executing the command ./macos-guest-virtualbox.sh documentation

The majority of the script is either documentation, comments, or actionable error messages, which should make the script straightforward to inspect and understand.

iCloud and iMessage connectivity and NVRAM

iCloud, iMessage, and other connected Apple services require a valid device name and serial number, board ID and serial number, and other genuine (or genuine-like) Apple parameters. These can be set in EFI and NVRAM by editing the script. See the documentation command for further information.

Storage size

The script by default assigns a target virtual disk storage size of 80GB, which is populated to about 25GB on the host on initial installation. After the installation is complete, the storage size may be increased. See the documentation command for further information.

Primary display resolution

The following primary display resolutions are supported by macOS on VirtualBox: 5120x2880 2880x1800 2560x1600 2560x1440 1920x1200 1600x1200 1680x1050 1440x900 1280x800 1024x768 640x480. See the documentation command for further information.

Scope and unsupported features

The scope of the script is completing a default macOS install process on VirtualBox on supported hardware. Further functioning order of VirtualBox or macOS is beyond the scope of this script. Some features may behave unexpectedly, such as USB device support, audio support, FileVault boot password prompt support, and other features, including critical functionality.

CPU compatibility

The script is designed for x86 CPU Mac hardware. macOS guests on VirtualBox are generally incompatible with other CPU models. If the guest macOS boot process hangs on “LoadKernelFromStream”, “EndRandomSeed”, or "EXITBS", see the documentation command regarding VirtualBox CPU profiles and CPUID settings. Some CPU models released in 2020 and later may fail to start or complete the installer, and may require manually adjusting the CPUID settings.

Upgrading to Big Sur and Monterey

The virtual machine may be upgraded to the latest macOS Big Sur (11) and macOS Monterey (12) versions through Software Update. Big Sur may be installed in-place. Monterey may require attaching another volume to the virtual machine and selecting the volume as the installation target, otherwise the upgrade is prone to failing and entering a boot loop.

Performance and deployment

After successfully creating a working macOS virtual machine, consider importing it into more performant virtualization software, or packaging it for configuration management platforms for automated deployment. These virtualization and deployment applications require additional configuration that is beyond the scope of the script.

QEMU with KVM is capable of providing virtual machine hardware passthrough for near-native performance. QEMU supports the VMDK virtual disk image storage format, which can be configured to be created by the script. See the documentation command for further information. QEMU and KVM require additional configuration that is beyond the scope of the script.

VirtualBox Native Execution Manager (NEM)

The VirtualBox Native Execution Manager (NEM) is an experimental VirtualBox feature. VirtualBox uses NEM when access to VT-x and AMD-V is blocked by virtualization software or execution protection features such as Hyper-V, WSL2, WSLg, Windows Sandbox, memory integrity protection, Application Guard, Credential Guard, Device Guard, and other features and software. macOS and the macOS installer have memory corruption issues under NEM virtualization. The script checks for NEM and exits with an error message if it is detected.

VirtualBox can run on WSL2 and WSLg with some kernel module compilation, though performance is extremely low. At the point that kernel module compilation is required, it may be preferable to use QEMU/KVM on WSL2 and WSLg, which is orders of magnitude faster than VirtualBox on WSL2 and WSLg. WSL2, WSLg, QEMU, and KVM require additional configuration that is beyond the scope of the script.

Bootloaders

The macOS VirtualBox guest is loaded without extra bootloaders, but it is compatible with OpenCore. OpenCore requires additional configuration that is beyond the scope of the script.

Audio

macOS may not support any built-in VirtualBox audio controllers. The bootloader OpenCore may be able to load open-source or built-in audio drivers in VirtualBox, providing the configuration for STAC9221 (Intel HD Audio) or SigmaTel STAC9700,83,84 (ICH AC97) is available.

Display scaling

VirtualBox does not supply an EDID for its virtual display, and macOS does not enable display scaling (high PPI) without an EDID. The bootloader OpenCore can inject an EDID which enables display scaling.

FileVault

The VirtualBox EFI implementation does not properly load the FileVault full disk encryption password prompt upon boot. The bootloader OpenCore is able to load the password prompt with the parameter ProvideConsoleGop set to true. See sample config.plist

Dependencies

The following dependencies should be available through a package manager:
bash coreutils gzip unzip wget xxd dmg2img virtualbox

The following optional packages provide optical character recognition that reduces the required interaction with the script:
tesseract-ocr tesseract-ocr-eng

Supported versions:

macos-virtualbox (myspaghetti/macos-virtualbox)

Searching Database…

13.5K ·GitHub
archived
这是什么?一个 Bash 脚本,可在 VirtualBox 中自动创建 macOS 虚拟机(Catalina、Mojave 或 High Sierra),所用安装文件未经修改,直接从苹果官方服务器下载。
这是图形界面安装程序,还是需要在终端里运行的脚本?这是一个单独的 shell 脚本,在 Bash 或 zsh 中运行即可,没有图形界面。使用 'documentation' 参数运行时,该脚本还兼作说明文档。
我到底该怎么运行它?先安装列出的依赖,然后运行 './macos-guest-virtualbox.sh',按提示按几次回车键即可。脚本会为你创建并启动虚拟机,无需你自己在虚拟机系统里操作。
运行脚本前需要先安装什么?必需的有 bash、coreutils、gzip、unzip、wget、xxd、dmg2img 和 VirtualBox(≥6.1.6);tesseract-ocr 是可选的,但装上后脚本需要的手动操作会减少。
这个项目还在维护吗?哪些功能效果不好?该仓库已归档,正在寻找新的维护者。脚本的适用范围也比较窄:USB、音频以及 FileVault 的开机密码提示都不稳定,部分 2020 年及以后发布的 CPU 可能需要手动调整 CPUID 才能启动。
我能在 Windows 和 Linux 上运行,还是只能在 Mac 上?它可在 macOS、CentOS 7 以及通过 Cygwin 运行的 Windows 上使用,前提是 CPU 为支持 VT-x 或 AMD-V 的 x86 处理器;大多数现代 Linux 发行版理论上也应可用。
虚拟机装好后,能把系统从 High Sierra 升级到更新版本吗?可以,之后可通过软件更新升级到 Big Sur 或 Monterey。Big Sur 可以原地升级,而 Monterey 通常需要挂载一个单独的卷,否则会陷入启动循环。
虚拟机里能用 iMessage 和 iCloud 吗?只有修改脚本,在 EFI/NVRAM 中设置真实(或类似真实的)苹果设备名称、序列号和主板 ID 才行,因为这些服务需要真实的苹果标识符。
装好之后,能获得比 VirtualBox 更好的性能吗?脚本可以生成 VMDK 磁盘镜像,这样你就能把做好的虚拟机导入 QEMU/KVM,它支持硬件直通,性能可接近原生;不过这套配置超出了脚本本身的范围。
虚拟机需要多大的磁盘?默认分配 80GB 的虚拟磁盘,刚装完时在宿主机上仅实际占用约 25GB。
What are similar projects?vphone-aio, macos, ProxmoxVE, Proxmox, Docker-OSX, qemu, vfkit, cua
Size
0.8 MB
Stars
13.5K
Age
7y
Commits · 90 Days