在 pc 上通过虚拟机 virtualbox 安装 macos

1,558 阅读2分钟

因手头无 mac 电脑, 要调试基于 electron 开发的软件, 在 macos 上面的效果时, 就考虑通过虚拟机安装 macos , 最终效果满意.

image.png

下文仅对需特殊处理的两个地方进行描述.

根据本机电脑处理器设置

接下来,需要用管理员权限运行 CMD,根据本机处理, 执行下面对应指令.

intel 处理器:

cd "C:\Program Files\Oracle\VirtualBox\"
VBoxManage.exe modifyvm "mac" --cpuidset 00000001 000106e5 00100800 0098e3fd bfebfbff
VBoxManage setextradata "mac" "VBoxInternal/Devices/efi/0/Config/DmiSystemProduct" "iMac19,1"
VBoxManage setextradata "mac" "VBoxInternal/Devices/efi/0/Config/DmiBoardProduct" "Mac-551B86E5744E2388"
VBoxManage setextradata "mac" "VBoxInternal/Devices/smc/0/Config/DeviceKey" "ourhardworkbythesewordsguardedpleasedontsteal(c)AppleComputerInc"
VBoxManage setextradata "mac" "VBoxInternal/Devices/smc/0/Config/GetKeyFromRealSMC" 1
VBoxManage modifyvm "mac" --vram 256

AMD 处理器:

cd "C:\Program Files\Oracle\VirtualBox\"
VBoxManage.exe modifyvm "mac" --cpuidset 00000001 000106e5 00100800 0098e3fd bfebfbff
VBoxManage setextradata "mac" "VBoxInternal/Devices/efi/0/Config/DmiSystemProduct" "iMac11,3"
VBoxManage setextradata "mac" "VBoxInternal/Devices/efi/0/Config/DmiSystemVersion" "1.0"
VBoxManage setextradata "mac" "VBoxInternal/Devices/efi/0/Config/DmiBoardProduct" "Iloveapple"
VBoxManage setextradata "mac" "VBoxInternal/Devices/smc/0/Config/DeviceKey" "ourhardworkbythesewordsguardedpleasedontsteal(c)AppleComputerInc"
VBoxManage setextradata "mac" "VBoxInternal/Devices/smc/0/Config/GetKeyFromRealSMC" 1
VBoxManage modifyvm "mac" --cpu-profile "Intel Core i7-6700K"
VBoxManage modifyvm "mac" --vram 256

安装过程中的磁盘配置

如下图, 点磁盘工具,

image.png

如下图, 左边选中 VBOX HARDDISK Media,右边点抹掉,然后名字写 英文的,格式选 APFS

image.png

参考:

更具体的安装步骤可以参考下面两个链接: