虛擬機安裝蘋果實踐,在Windows10系統,安裝Virtual Box7.1.6,安裝虛擬蘋果Monterey版本Monterey?(macOS 12) 。碰到的主要問題是安裝光盤不像Windows那么容易拿到,而且根據網上很多文章制作的光盤,在viritualBox里都無法引導啟動,最后只有一個big sur版本的iso可以啟動,見后面調試部分。
下載安裝軟件
?經過多次嘗試,只有這個鏈接里面拿到的Mac OS 盤是可以在virtualBox里引導啟動的。
這篇文檔里有個big sur版本mac的下載地址:VirtualBox 7.0 安裝 macOS big sur + Windows 11系統-零度博客
以下制作的iso光盤都無法在VirtualBox里引導啟動,留檔。?
嘗試下載10.12版本(無法啟動)
先下載一個較老的版本10.12,下載頁面:如何下載和安裝 macOS - 官方 Apple 支持 (中國)
具體下載鏈接:http://updates-http.cdn-apple.com/2019/cert/061-39476-20191023-48f365f4-0015-4c41-9f44-39d3d2aca067/InstallOS.dmg
轉換格式,到華軍軟件園下載轉換軟件:dmg轉iso(dmg2img)下載2025最新pc版_dmg轉iso(dmg2img)電腦版官方免費下載_華軍軟件園?
使用命令dmg2img.exe InstallOS.dmg InstallOS.iso 轉換:
e:\360Downloads>e:\tools\dmg2img\dmg2img.exe InstallOS.dmg InstallOS.isodmg2img v1.6.2 is derived from dmg2iso by vu1tur (to@vu1tur.eu.org)InstallOS.dmg --> InstallOS.isoreading property list, 306327 bytes from address 5007575287 ...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
opening partition 8 ... 100.00% okArchive successfully decompressed as InstallOS.iso
經測試,這樣轉換的iso文件不行。
下載Big Sur和Monterey并轉換dmg到iso文件(無法啟動)
?如何在Windows 10的VirtualBox中安裝macOS High Sierra:如何在Windows 10的VirtualBox中安裝macOS High Sierra-騰訊云開發者社區-騰訊云
查看下載的安裝文件,在/Applications
Install macOS Big Sur.app
Install macOS Monterey.app
具體來說,Monterry的盤在這里:/Applications/Install macOS Monterey.app/Contents/SharedSupport
ls -l
total 24235624
-rw-r--r-- 1 root wheel 12408638012 2 27 20:19 SharedSupport.dmg
?創建空白磁盤
hdiutil create -o /tmp/HighSierra.cdr -size 7316m -layout SPUD -fs HFS+J
hdiutil create -o /tmp/Monterey.cdr -size 12412m -layout SPUD -fs HFS+J
掛載空白磁盤
hdiutil attach /tmp/Monterey.cdr.dmg -noverify -nobrowse -mountpoint /Volumes/install_build
掛載成功
hdiutil attach /tmp/Monterey.cdr.dmg -noverify -nobrowse -mountpoint /Volumes/install_build
/dev/disk3 Apple_partition_scheme
/dev/disk3s1 Apple_partition_map
/dev/disk3s2 Apple_HFS /Volumes/install_build
?從安裝程序中還原安裝鏡像到掛載的空白磁盤
asr restore --source "/Applications/Install macOS Monterey.app/Contents/SharedSupport/SharedSupport.dmg" --target /Volumes/Install_build --noprompt --noverify -erase
注意,原文檔里參數只有一個“-”,會報錯,要修改成兩個"--"
輸出信息說:
Restored target device is /dev/disk3s2.
也就是/dev/disk3s2 這個盤,掛載點為/Volumes/install_build ,已經做成MacOS啟動盤了
因為前面知道創建的空白磁盤是/dev/disk3,所以直接卸載它就行了。可以到“訪達”里用鼠標點擊卸載,也可以用命令
hdiutil detach /dev/disk3
將dmg變成iso
hdiutil convert /tmp/Monterey.cdr.dmg -format UDTO -o /tmp/Monterey.iso
完成:created: /tmp/Monterey.iso.cdr?
但是用這個文件在virtualbox里還是無法啟動。
嘗試學習用hdiutil轉換dmg到iso(無法啟動)?
hdiutil makehybrid -iso -o Monterey.iso /tmp/Monterey.cdr.dmg
執行這些命令:
首先,運行以下命令以創建空白磁盤映像:
hdiutil create -o /tmp/HighSierra.cdr -size 7316m -layout SPUD -fs HFS+J
接下來,掛載空白鏡像:
hdiutil attach /tmp/HighSierra.cdr.dmg -noverify -nobrowse -mountpoint /Volumes/install_build
現在,您將從安裝程序中還原BaseSystem.dmg到新安裝的映像:
asr restore -source /Applications/Install/macOS/High/Sierra.app/Contents/SharedSupport/BaseSystem.dmg -target /Volumes/Install_build -noprompt -noverify -erase
請注意,執行完此操作后,目標掛載點的名稱已更改為“ OS X Base System / System”。你幾乎已經完成!卸載圖像:
hdiutil detach /Volumes/OS/X/Base/System
最后,將您創建的映像轉換為ISO文件:
hdiutil convert /tmp/HighSierra.cdr.dmg -format UDTO -o /tmp/HighSierra.iso
將ISO移至桌面:
mv /tmp/HighSierra.iso.cdr ~/Desktop/HighSierra.iso
您已經擁有可引導的High Sierra ISO文件!
此方法未測試成功。
創建virtualbox mac虛擬機
知乎一篇文章講到這樣:
VBoxManage.exe modifyvm MacOS --cpuidset 00000001 000106e5 00100800 0098e3fd bfebfbffVBoxManage setextradata MacOS "VBoxInternal/Devices/efi/0/Config/DmiSystemProduct" "iMac11,3"VBoxManage setextradata MacOS "VBoxInternal/Devices/efi/0/Config/DmiSystemVersion" "1.0"VBoxManage setextradata MacOS "VBoxInternal/Devices/efi/0/Config/DmiBoardProduct" "Iloveapple"VBoxManage setextradata MacOS "VBoxInternal/Devices/smc/0/Config/DeviceKey" "ourhardworkbythesewordsguardedpleasedontsteal(c)AppleComputerInc"VBoxManage setextradata MacOS "VBoxInternal/Devices/smc/0/Config/GetKeyFromRealSMC" 1# 修改屏幕分辨率為 1440 * 900
VBoxManage setextradata MacOS VBoxInternal2/EfiGopMode 4# VirtualBox5.2版本修改分辨率命令
VBoxManage setextradata MacOS VBoxInternal2/EfiGraphicsResolution 1440x900
其實應該不用吧,現在直接有macos的虛擬機選項了。
蘋果版本號對應表:
-
Sonoma?(macOS 14)
- 發布年份:2023
- 主要特性:增強的桌面小部件、改進的游戲體驗、Safari 的新功能等。
-
Ventura?(macOS 13)
- 發布年份:2022
- 主要特性:引入了 Stage Manager、改進的郵件和信息應用、增強的隱私保護等。
-
Monterey?(macOS 12)
- 發布年份:2021
- 主要特性:引入了 Focus 模式、快捷指令、Universal Control 等。
-
Big Sur?(macOS 11)
- 發布年份:2020
- 主要特性:全新的用戶界面設計、控制中心、改進的 Safari 瀏覽器等。
-
Catalina?(macOS 10.15)
- 發布年份:2019
- 主要特性:引入了 Sidecar、屏幕時間、完全移除 iTunes 等。
-
Mojave?(macOS 10.14)
- 發布年份:2018
- 主要特性:引入了黑暗模式、桌面堆棧、改進的屏幕截圖工具等。
-
High Sierra?(macOS 10.13)
- 發布年份:2017
- 主要特性:引入了 APFS 文件系統、改進的照片應用、Metal 2 圖形技術等。
-
Sierra?(macOS 10.12)
- 發布年份:2016
- 主要特性:引入了 Siri、優化的文件管理、Apple Pay 支持等。
-
El Capitan?(macOS 10.11)
- 發布年份:2015
- 主要特性:改進的窗口管理、Split View、增強的 Spotlight 搜索等。
-
Yosemite?(macOS 10.10)
- 發布年份:2014
- 主要特性:全新的用戶界面設計、Handoff 功能、改進的通知中心等。
其它學習
下載mac軟件
參考:Making the installer in macOS | OpenCore Install Guide
Using App Store
From a macOS machine that meets the requirements of the OS version you want to install, go directly to the App Store and download the desired OS release and continue to Setting up the installer.
#
Command Line Software Update Utility
Open a terminal window then copy and paste the below command:
sh
softwareupdate --list-full-installers; echo; echo "Please enter version number you wish to download:"; read REPLY; [ -n "$REPLY" ] && softwareupdate --fetch-full-installer --full-installer-version "$REPLY"

This gives you a list of available releases you can choose from. Once downloaded it will be saved in your Applications folder. You can continue to Setting up the installer.
#
Munki's InstallInstallMacOS utility
Note for users running macOS Monterey 12.3 or above
In order to run it, just copy and paste the below command in a terminal window:
sh
mkdir -p ~/macOS-installer && cd ~/macOS-installer && curl https://raw.githubusercontent.com/munki/macadmin-scripts/main/installinstallmacos.py > installinstallmacos.py && sudo
?python installinstallmacos.py

As you can see, we get a nice list of macOS installers. If you need a particular versions of macOS, you can select it by typing the number next to it. For this example we'll choose 10:

This is going to take a while as we're downloading the entire 8GB+ macOS installer, so it's highly recommended to read the rest of the guide while you wait.
Once finished, you'll find in your ~/macOS-Installer/ folder a DMG containing the macOS Installer, called Install_macOS_11.1-20C69.dmg for example. Mount it and you'll find the installer application.
? Note: We recommend to move the Install macOS.app into the /Applications folder, as we'll be executing commands from there.
? Note 2: Running Cmd+Shift+G in Finder will allow you to easily jump to ~/macOS-installer


From here, jump to Setting up the installer to finish your work. If you want to check the integrity of your download, you can check this repository of checks
softwareupdate --list-full-installers; echo; echo "Please enter version number you wish to download:"; read REPLY; [ -n "$REPLY" ] && softwareupdate --fetch-full-installer --full-installer-version "$REPLY"
參考如何在windows下安裝mac虛擬機安裝 | PingCode智庫
使用VirtualBox安裝macOS
1、安裝Oracle VM VirtualBox
下載并安裝VirtualBox。完成后,安裝VirtualBox擴展包以獲得更好的性能和更多的功能。
2、創建新的虛擬機
打開VirtualBox,點擊“新建”。
- 輸入虛擬機名稱,類型選擇“Mac OS X”,版本選擇對應的macOS版本,點擊“下一步”。
- 分配內存大小,建議至少分配8GB,點擊“下一步”。
- 創建虛擬硬盤,選擇“VDI(VirtualBox磁盤映像)”,點擊“下一步”。
- 硬盤類型選擇“動態分配”,點擊“下一步”。
- 指定虛擬硬盤文件的位置和大小,點擊“創建”。
3、加載macOS鏡像文件
- 右鍵點擊創建好的虛擬機,選擇“設置”。
- 在“系統”選項中,確保啟用“EFI(特殊操作系統的唯一固件接口)”。
- 在“存儲”選項中,選擇“空”,然后點擊光盤圖標,選擇“選擇虛擬光盤文件”,選擇macOS鏡像文件。
4、運行命令行配置(這個非必須)
關閉VirtualBox,打開命令提示符(以管理員身份運行),運行以下命令來配置虛擬機:
cd "C:Program FilesOracleVirtualBox"
VBoxManage modifyvm "你的虛擬機名稱" --cpuidset 00000001 000106e5 00100800 0098e3fd bfebfbff
VBoxManage setextradata "你的虛擬機名稱" "VBoxInternal/Devices/efi/0/Config/DmiSystemProduct" "iMac11,3"
VBoxManage setextradata "你的虛擬機名稱" "VBoxInternal/Devices/efi/0/Config/DmiSystemVersion" "1.0"
VBoxManage setextradata "你的虛擬機名稱" "VBoxInternal/Devices/efi/0/Config/DmiBoardProduct" "Iloveapple"
VBoxManage setextradata "你的虛擬機名稱" "VBoxInternal/Devices/smc/0/Config/DeviceKey" "ourhardworkbythesewordsguardedpleasedontsteal(c)AppleComputerInc"
VBoxManage setextradata "你的虛擬機名稱" "VBoxInternal/Devices/smc/0/Config/GetKeyFromRealSMC" 1
5、啟動虛擬機并安裝macOS
- 打開VirtualBox,啟動虛擬機。
- 虛擬機會啟動macOS安裝程序,按照提示進行安裝。
實踐下來,啟動非常慢,大約要20-30分鐘才能進入mac安裝界面
調試
啟動后無法從光盤啟動。
解決中。經過多次嘗試,只有這個鏈接里面拿到的Mac OS 盤是可以在virtualBox里引導啟動的。
這篇文檔里有個big sur版本mac的下載地址:VirtualBox 7.0 安裝 macOS big sur + Windows 11系統-零度博客
這個盤是可以啟動的?
啟動后報錯:
Failed to query SMC value from the host (VERR_INVALID_HANDLE).
返回?代碼: | E_FAIL (0x80004005) |
組件: | ConsoleWrap |
界面: | IConsole {6ac83d89-6ee7-4e33-8ae6-b257b2e81be8} |
嘗試禁用禁用SMC查詢
?VBoxManage.exe setextradata "MacOS" "VBoxInternal/Devices/smc/0/Config/GetKeyFromRealSMC" 0
確實管用,又重復原來無法從光盤啟動的問題了。光盤啟動問題解決見上面。