因手头无 mac 电脑, 要调试基于 electron 开发的软件, 在 macos 上面的效果时, 就考虑通过虚拟机安装 macos , 最终效果满意.
-
从 virtualbox 官网 下载最新安装包, 默认安装即可.
-
下载 macos iso 安装包, 参考 macos-catalina-on-virtualbox-windows
下文仅对需特殊处理的两个地方进行描述.
根据本机电脑处理器设置
接下来,需要用管理员权限运行 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
安装过程中的磁盘配置
如下图, 点磁盘工具,
如下图, 左边选中 VBOX HARDDISK Media,右边点抹掉,然后名字写 英文的,格式选 APFS
参考:
更具体的安装步骤可以参考下面两个链接: