如何在Windows 10的VirtualBox中安裝macOS High Sierra

無論您是想偶爾在Safari中測試網(wǎng)站還是在Mac環(huán)境中試用一些軟件,訪問虛擬機中最新版本的macOS都是很有用的。不幸的是,您實際上不應該執(zhí)行此操作,因此,至少可以說,在VirtualBox中運行macOS很難。

image

第一步:創(chuàng)建macOS High Sierra ISO文件

首先,我們需要創(chuàng)建macOS High Sierra安裝程序的ISO文件,以便將其加載到Windows機器上的VirtualBox中。拿起借來的Mac,前往Mac App Store,搜索Sierra,然后單擊“下載”。

image

完成該過程后,安裝程序將啟動-可以,只需使用Command + Q將其關閉。我們不想升級您朋友的Mac;我們只需要下載的文件。

要將這些文件轉換為ISO,我們需要使用終端,您可以在“應用程序”>“實用程序”中找到該終端。

image

首先,運行以下命令以創(chuàng)建空白磁盤映像:

<pre style="box-sizing: border-box; outline: none; margin: 0px; padding: 0px; border: 0px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-variant-numeric: inherit; font-variant-east-asian: inherit; font-weight: 400; font-stretch: inherit; font-size: 18px; line-height: inherit; font-family: couriernew, courier, monospace; vertical-align: baseline; color: rgb(93, 93, 93); letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-style: initial; text-decoration-color: initial;">

hdiutil create -o /tmp/HighSierra.cdr -size 7316m -layout SPUD -fs HFS+J

</pre>

接下來,掛載空白鏡像:

<pre style="box-sizing: border-box; outline: none; margin: 0px; padding: 0px; border: 0px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-variant-numeric: inherit; font-variant-east-asian: inherit; font-weight: 400; font-stretch: inherit; font-size: 18px; line-height: inherit; font-family: couriernew, courier, monospace; vertical-align: baseline; color: rgb(93, 93, 93); letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-style: initial; text-decoration-color: initial;">

hdiutil attach /tmp/HighSierra.cdr.dmg -noverify -nobrowse -mountpoint /Volumes/install_build

</pre>

現(xiàn)在,您將從安裝程序中還原BaseSystem.dmg到新安裝的映像:

<pre style="box-sizing: border-box; outline: none; margin: 0px; padding: 0px; border: 0px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-variant-numeric: inherit; font-variant-east-asian: inherit; font-weight: 400; font-stretch: inherit; font-size: 18px; line-height: inherit; font-family: couriernew, courier, monospace; vertical-align: baseline; color: rgb(93, 93, 93); letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-style: initial; text-decoration-color: initial;">

asr restore -source /Applications/Install/macOS/High/Sierra.app/Contents/SharedSupport/BaseSystem.dmg -target /Volumes/Install_build -noprompt -noverify -erase

</pre>

請注意,執(zhí)行完此操作后,目標掛載點的名稱已更改為“ OS X Base System / System”。你幾乎已經(jīng)完成!卸載圖像:

<pre style="box-sizing: border-box; outline: none; margin: 0px; padding: 0px; border: 0px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-variant-numeric: inherit; font-variant-east-asian: inherit; font-weight: 400; font-stretch: inherit; font-size: 18px; line-height: inherit; font-family: couriernew, courier, monospace; vertical-align: baseline; color: rgb(93, 93, 93); letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-style: initial; text-decoration-color: initial;">

hdiutil detach /Volumes/OS/X/Base/System

</pre>

最后,將您創(chuàng)建的映像轉換為ISO文件:

<pre style="box-sizing: border-box; outline: none; margin: 0px; padding: 0px; border: 0px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-variant-numeric: inherit; font-variant-east-asian: inherit; font-weight: 400; font-stretch: inherit; font-size: 18px; line-height: inherit; font-family: couriernew, courier, monospace; vertical-align: baseline; color: rgb(93, 93, 93); letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-style: initial; text-decoration-color: initial;">

hdiutil convert /tmp/HighSierra.cdr.dmg -format UDTO -o /tmp/HighSierra.iso

</pre>

將ISO移至桌面:

<pre style="box-sizing: border-box; outline: none; margin: 0px; padding: 0px; border: 0px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-variant-numeric: inherit; font-variant-east-asian: inherit; font-weight: 400; font-stretch: inherit; font-size: 18px; line-height: inherit; font-family: couriernew, courier, monospace; vertical-align: baseline; color: rgb(93, 93, 93); letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-style: initial; text-decoration-color: initial;">

mv /tmp/HighSierra.iso.cdr ~/Desktop/HighSierra.iso

</pre>

您已經(jīng)擁有可引導的High Sierra ISO文件!

使用移動硬盤,U盤或通過本地網(wǎng)絡將其復制到Windows計算機。

第二步:在VirtualBox中創(chuàng)建虛擬機

接下來,轉到Windows計算機,如果尚未安裝VirtualBox,請確保已安裝最新版本。

打開它,然后單擊“新建”按鈕。將虛擬機命名為“ High Sierra”,然后為操作系統(tǒng)選擇“ Mac OS X”,為版本選擇“ Mac OS X(64位)”

image

繼續(xù)進行此過程。對于內存,我們建議您至少使用4096MB,但如果Windows計算機上有足夠的RAM可用,則可以選擇更大的內存。

image

接下來,將詢問您有關硬盤的信息。選擇“立即創(chuàng)建虛擬硬盤”,然后單擊“創(chuàng)建”。

image

選擇VDI作為硬盤類型,然后單擊“下一步”。系統(tǒng)將詢問您是否需要動態(tài)調整大小的驅動器或固定驅動器。我們建議使用“固定大小”,因為它雖然速度更快,但是會占用Windows計算機更多的硬盤空間。

image

點擊下一步。系統(tǒng)將詢問您想要多大的驅動器;我們建議至少有25GB,對于操作系統(tǒng)和一些應用程序來說足夠大了。根據(jù)您的存儲狀況,您可以提供更多,但我們認為您的使用量不能少于此。

單擊提示,您已經(jīng)為虛擬機創(chuàng)建了一個條目!現(xiàn)在是時候進行一些配置了。

第三步:在VirtualBox中配置虛擬機

您應該在VirtualBox的主窗口中看到您的虛擬機。

image

選擇它,然后單擊黃色的大“設置”按鈕。首先,轉到左側邊欄中的“系統(tǒng)”。在“主板”選項卡上,確保未選中“軟盤”。

image

接下來轉到“處理器”選項卡,并確保至少有兩個CPU分配給虛擬機。

image

接下來,單擊左側欄中的“顯示”,并確保“視頻內存”設置為至少128MB。

image

接下來,單擊左側欄中的“存儲”,然后單擊“空” CD驅動器。單擊右上角的CD圖標,然后瀏覽到您之前創(chuàng)建的High Sierra ISO文件。

image

確保單擊“確定”以完成您所做的所有更改,然后關閉VirtualBox。

第四步:從命令提示符配置虛擬機

我們做了一些調整,但是我們需要做更多調整,才能說服它在真實Mac上運行。可悲的是,VirtualBox的界面中沒有用于此的選項,因此您需要打開命令提示符。

image

打開“開始”菜單,搜索“命令提示符”,然后右鍵單擊它并選擇“以管理員身份運行”。

image

您需要按順序運行數(shù)字命令。粘貼以下命令,在每個命令之后按Enter并等待其完成:

<pre style="box-sizing: border-box; outline: none; margin: 0px; padding: 0px; border: 0px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-variant-numeric: inherit; font-variant-east-asian: inherit; font-weight: 400; font-stretch: inherit; font-size: 18px; line-height: inherit; font-family: couriernew, courier, monospace; vertical-align: baseline; color: rgb(93, 93, 93); letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-style: initial; text-decoration-color: initial;">

cd  "C:\Program Files\OracleVirtualBox"
VBoxManage.exe Modifyvm "High Sierra" --cpuidset 00000001 000306a9 04100800 7fbae3ff bfebfbff
VBoxManage setextradata "High Sierra" "VBoxInternal/Devices/efi/0/Config/DmiSystemProduct" "MacBookPro11,3"
VBoxManage setextradata "High Sierra" "VBoxInternal/Devices/efi/0/Config/DmiSystemVersion" "1.0"
VBoxManage setextradata "High Sierra" "VBoxInternal/Devices/efi/0/Config/DmiBoardProduct" "Mac-2BD1B31983FE1663"
VBoxManage setextradata "High Sierra" "VBoxInternal/Devices/smc/0/Config/DeviceKey" "ourhardworkbythesewordsguardedpleasedontsteal(c)AppleComputerInc"
VBoxManage setextradata "High Sierra" "VBoxInternal/Devices/smc/0/Config/GetKeyFromRealSMC" 1

</pre>

如果一切正常,您應該看不到任何反饋。這些命令將簡單地運行。如果該命令不起作用,請確保您的虛擬機準確命名為“ High Sierra”。如果不是,請編輯上面的命令,將機器名稱加引號。繼續(xù)并關閉命令提示符。我們現(xiàn)在回到VirtualBox。

第五步:引導并運行安裝程序

重新打開VirtualBox,單擊您的Sierra計算機,然后單擊“開始”。您的計算機將開始啟動。發(fā)生這種情況時,您會看到很多多余的信息-我的意思是很多 -但不要擔心。這是正?,F(xiàn)象,甚至某些看起來像錯誤的事情也是如此。

僅當特定錯誤掛起五分鐘或更長時間時,您才應該擔心。只是走開,讓它運行一點。如果一切正確,它將啟動。

最終,您將看到安裝程序要求您選擇一種語言:

image

選擇“英語”或您喜歡的任何一種語言,然后單擊“下一步”。但是,在執(zhí)行其他任何操作之前,請單擊“磁盤工具”,然后單擊“繼續(xù)”。

image

您不會看到驅動器:不要驚慌,High Sierra默認情況下會隱藏空白驅動器。在菜單欄中,單擊“查看”,然后單擊“顯示所有設備”。

image

現(xiàn)在,您應該在側欄中看到空的虛擬驅動器。單擊它,然后單擊“擦除”選項。

image

將驅動器命名為“ Macintosh HD”,而其他兩個設置保持不變:“ Mac OS Extended Journaled”和“ GUID Partition Map”。不要創(chuàng)建AFS分區(qū),因為它將無法正常工作,并且您必須重新開始使用新的虛擬硬盤驅動器。單擊“擦除”,然后在該過程完成后關閉“磁盤工具”。您將被帶回到主窗口。

image

選擇“重新安裝macOS”,然后單擊“繼續(xù)”。系統(tǒng)會要求您同意這些條款。

image

同意,最終您將被要求選擇一個硬盤。選擇剛創(chuàng)建的分區(qū)。

image

安裝將開始!這可能需要一段時間,請耐心等待。最終,您的虛擬機將重新啟動,并帶您回到安裝程序。不要驚慌:這是意料之中的。

第六步:從虛擬硬盤啟動引導安裝程序第二階段

此時,安裝程序已將文件復制到虛擬硬盤驅動器,并希望從那里啟動。無論出于何種原因,這在虛擬機上均不起作用,這就是為什么您再次看到安裝程序的原因。

image

關閉您的虛擬機并打開其設置。轉到存儲,在“存儲樹”面板中單擊“ HighSierra.iso”,然后單擊右上角的CD圖標,然后單擊“從虛擬驅動器中刪除磁盤”。這將完全斷開安裝ISO的連接。

現(xiàn)在啟動虛擬機,您將看到這個漂亮的屏幕。

image

這是EFI內部外殼,只要您看到以黃色列出的“ FS1”,就可以使用它啟動其余的安裝程序。單擊虛擬機,并使其捕獲鼠標和鍵盤,然后鍵入fs1: 并按Enter。這會將目錄切換到安裝程序其余部分所在的FS1。

接下來,我們將運行一些命令以切換到所需的目錄:

<pre style="box-sizing: border-box; outline: none; margin: 0px; padding: 0px; border: 0px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-variant-numeric: inherit; font-variant-east-asian: inherit; font-weight: 400; font-stretch: inherit; font-size: 18px; line-height: inherit; font-family: couriernew, courier, monospace; vertical-align: baseline; color: rgb(93, 93, 93); letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-style: initial; text-decoration-color: initial;">

cd "macOS Install Data"
cd "Locked Files"
cd "Boot Files"

</pre>

現(xiàn)在,我們可以使用以下命令運行安裝程序本身:

<pre style="box-sizing: border-box; outline: none; margin: 0px; padding: 0px; border: 0px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-variant-numeric: inherit; font-variant-east-asian: inherit; font-weight: 400; font-stretch: inherit; font-size: 18px; line-height: inherit; font-family: couriernew, courier, monospace; vertical-align: baseline; color: rgb(93, 93, 93); letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-style: initial; text-decoration-color: initial;">

boot.efi

</pre>

安裝程序將從停止的地方繼續(xù)安裝。首先,您將看到一系列文本,就像以前一樣,但是最終您將看到GUI安裝程序回來。(不用擔心,您只需執(zhí)行一次此過程。)

我們到了那里,只需要多一點耐心。

第八步:登錄到macOS High Sierra

最終,虛擬機將再次重新引導,這次進入macOS High Sierra。如果沒有發(fā)生,請嘗試從虛擬機彈出ISO。當High Sierra啟動時,您將需要選擇您的國家/地區(qū),設置用戶以及其余的初始設置過程。

最終,您將其安裝到Mac桌面上。好極了!

現(xiàn)在,您可以試用任何Mac軟件,盡管某些功能(例如FaceTime和Messages)將無法使用,因為Apple無法將您的計算機識別為真正的Mac。但是很多基本的東西都應該起作用。玩得開心!

步驟八(可選):更改分辨率

默認情況下,您的虛擬機將具有1024×768的分辨率,沒有太多的工作空間。但是,如果嘗試在macOS內更改分辨率,則將看不到任何選擇。相反,您需要輸入一些命令。

通過關閉macOS關閉虛擬機:單擊菜單欄中的Apple,然后單擊“關閉”。接下來,完全關閉VirtualBox(嚴重的是,如果VirtualBox仍處于打開狀態(tài),則此步驟將不起作用?。缓笠怨芾韱T身份返回Windows的命令提示符。您需要運行以下兩個命令:

<pre style="box-sizing: border-box; outline: none; margin: 0px; padding: 0px; border: 0px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-variant-numeric: inherit; font-variant-east-asian: inherit; font-weight: 400; font-stretch: inherit; font-size: 18px; line-height: inherit; font-family: couriernew, courier, monospace; vertical-align: baseline; color: rgb(93, 93, 93); letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-style: initial; text-decoration-color: initial;">

cd "C:\Program Files\OracleVirtualBox"
VBoxManage setextradata "High Sierra" "VBoxInternal2/EfiGopMode" N

</pre>

在第二個命令中,您需要N根據(jù)需要的分辨率用一個從1到5的數(shù)字替換:

  • 1為您提供800×600的分辨率
  • 2為您提供1024×768的分辨率
  • 3為您提供1280×1024的分辨率
  • 4為您提供1440×900的分辨率
  • 5為您提供1920×1200的分辨率

啟動VirtualBox,加載您的虛擬機,它將啟動至您的首選分辨率!

總結

雖然有些功能,比如聲音等還無法使用,但我們已經(jīng)能使用虛擬機進行一些程序的開發(fā)了。當然,如果您有足夠的金錢的話,買一個mac mini主機還是很香的。

?著作權歸作者所有,轉載或內容合作請聯(lián)系作者
【社區(qū)內容提示】社區(qū)部分內容疑似由AI輔助生成,瀏覽時請結合常識與多方信息審慎甄別。
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發(fā)布,文章內容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務。

友情鏈接更多精彩內容