需求: 因為需要調(diào)試內(nèi)核, VMware Funsion 需要iso 系統(tǒng), 但是發(fā)現(xiàn)網(wǎng)上基本上沒有相關(guān)系統(tǒng)鏡像, 大部分是dmg 鏡像, 所以只有自己制作
比如:這是appstore 的10.12.6的系統(tǒng) https://itunes.apple.com/us/app/macos-sierra/id1127487414?mt=12
下載下來后自動會放到/Application/中
方式一
制作鏡像: 我直接在下載macos 10.12.6 .dmg , 然后通過window 的iso 制作工具將其轉(zhuǎn)換成macos 10.12.6 .iso 格式, 然后放到VMware Funsion 直接安裝, 發(fā)現(xiàn)出現(xiàn)了錯誤:

這是怎么回事? 然后對比了一下我原來下載好其他版本的可安裝的iso 鏡像, 發(fā)現(xiàn)自己制作的iso里缺少很多文件, 原來直接將dmg轉(zhuǎn)成iso是無法作為mac的啟動盤的, 因為這樣少了很多的引導(dǎo)程序
方式二
根據(jù)上述的情況, 在網(wǎng)上找到了一篇帖子, 需要我們使用命令行去自己制作
1: 把下載好的dmg文件拷到mac上,或者直接在mac上下載, 不要使用什么百度網(wǎng)盤下載, 真的太慢了, 丫的限速
2:這里我直接使用AppStore 里的10.12.6 的版本, 下載好后直接會在/Application 中

3:打開終端: 按以下順序輸入命令,一共12條命令
1.1>>hdiutil attach /Applications/Install\ macOS\ Sierra.app/Contents/SharedSupport/InstallESD.dmg -noverify -nobrowse -mountpoint /Volumes/install_app
目的: 就是將我們下載系統(tǒng)[即在/Application中]關(guān)聯(lián)到Volumes/目錄下, 成為install_app

1.2>> hdiutil create -o /tmp/Sierra.cdr -size 7316m -layout SPUD -fs HFS+J
目的: 創(chuàng)建cdr 文件, 這個就是創(chuàng)建iso的前身, 所以放到臨時目錄下,因為到時會改成iso 并從臨時目錄下移除

1.3>>hdiutil attach /tmp/Sierra.cdr.dmg -noverify -nobrowse -mountpoint /Volumes/install_build
目的: 將上面的臨時文件關(guān)聯(lián)到/Volumes/目錄下,成為install_app

1.4>>asr restore -source /Volumes/install_app/BaseSystem.dmg -target /Volumes/install_build -noprompt -noverify -erase
目的: 將install_app 中BaseSystem.dmg 轉(zhuǎn)到/Volumes/install_build中

1.5>>rm /Volumes/OS\ X\ Base\ System/System/Installation/Packages
目的: 刪除Packages
1.6>>cp -rp /Volumes/install_app/Packages /Volumes/OS\ X\ Base\ System/System/Installation/
1.7>>cp -rp /Volumes/install_app/BaseSystem.chunklist /Volumes/OS\ X\ Base\ System/BaseSystem.chunklist
1.8>>cp -rp /Volumes/install_app/BaseSystem.dmg /Volumes/OS\ X\ Base\ System/BaseSystem.dmg
上述3個命令都是將install_app 的東西放到OSX Base System 中, OSX Base System存放就是最后iso 鏡像所有的內(nèi)容
1.9>> hdiutil detach /Volumes/install_app
目的: 解除關(guān)聯(lián)install_app

1.10>> hdiutil detach /Volumes/OS\ X\ Base\ System/
目的: 解除關(guān)聯(lián)osx Base System

1.11>>hdiutil convert /tmp/Sierra.cdr.dmg -format UDTO -o /tmp/Sierra.iso
將cdr.dmg臨時文件轉(zhuǎn)換成iso.cdr

1.12>> mv /tmp/Sierra.iso.cdr ~/Desktop/Sierra.iso
放到桌面,改成iso 的后綴
OK,搞定,現(xiàn)在在mac的桌面上你就可以發(fā)現(xiàn)有一個Sierra.iso的文件了
最后的ios 中的內(nèi)容:
