macOS インストーラのディスクイメージを作成する
はじめに
このドキュメントは.macOSのインストーラアプリを,ディスクイメージに作り替える.その目的はVMware FusionやVirtualBoxでmacOSのゲストOSを作成するために必要なので作成.今回はMontereyのインストールアプリケーションを使ったが,過去のOSインストーラでも同じ手順で作成できるはず.
前提
- あらかじめMontereyのインストーライメージがダウンロードされていること.
作業手順
結果的に
- 空のディスクイメージを作成.今回は15GB.
$ hdiutil create -o /tmp/macosinstaller -size 15g -volname
macosinstaller -layout SPUD -fs HFS+J🆑
created: /tmp/macosinstaller.dmg
$ ls -lah /tmp/macosinstaller.dmg🆑
-rw-r--r-- 1 ujpadmin wheel 15G 11 30 14:46
/tmp/macosinstaller.dmg
$
- 作成したディスクイメージをマウントする.
$ hdiutil attach /tmp/macosinstaller.dmg -noverify -mountpoint
/Volumes/MacOSinstaller🆑
/dev/disk3
Apple_partition_scheme
/dev/disk3s1
Apple_partition_map
/dev/disk3s2
Apple_HFS
/Volumes/MacOSinstaller🈁
$
- マウントしたボリュームを確認.
$ ls -la /Volumes🆑
total 0
drwxr-xr-x+ 6 root wheel 192 11 30
14:47 .
drwxr-xr-x 20 root wheel 640
1
1 2020 ..
drwxr-xr-x 5 ujpadmin staff 238 11 30 14:47
MacOSinstaller🈁
lrwxr-xr-x 1 root
wheel
1 10 23 01:28 MacPro2013 -> /
drwxr-xr-x 8 root wheel 340
8
24 19:54 'Shared Support'
drwxr-xr-x 11 ujpadmin staff 442 10 12 00:48
VirtualBox
$
- マウントしたディスクイメージにmacOSインストーラを作成する.
$ sudo /Applications/Install\ macOS\
Monterey.app/Contents/Resources/createinstallmedia --volume
/Volumes/MacOSinstaller --nointeraction🆑
Erasing disk: 0%... 10%... 20%... 30%... 100%
Making disk bootable...
Copying to disk: 0%... 10%... 20%... 30%... 40%... 50%... 100%
Install media now available at "/Volumes/Install macOS
Monterey"🈁
$
- マウント名が変わっていることを確認.
$ ls -la /Volumes/🆑
total 0
drwxr-xr-x+ 6 root wheel 192 11 30
14:48 .
drwxr-xr-x 20 root wheel 640
1
1 2020 ..
drwxrwxr-x 14 ujpadmin staff 544 11 30 14:49 'Install
macOS
Monterey'🈁
lrwxr-xr-x 1 root
wheel
1 10 23 01:28 MacPro2013 -> /
drwxr-xr-x 8 root wheel 340
8
24 19:54 'Shared Support'
drwxr-xr-x 11 ujpadmin staff 442 10 12 00:48
VirtualBox
$
- アンマウントする.
$ hdiutil detach /Volumes/Install\ macOS\ Monterey🆑
"disk3" ejected.
$ ls -la /Volumes/🆑
total 0
drwxr-xr-x+ 5 root wheel 160 11 30
14:50 .
drwxr-xr-x 20 root wheel 640
1
1 2020 ..
lrwxr-xr-x 1 root
wheel
1 10 23 01:28 MacPro2013 -> /
drwxr-xr-x 8 root wheel 340
8
24 19:54 'Shared Support'
drwxr-xr-x 11 ujpadmin staff 442 10 12 00:48
VirtualBox
$
- 作成されたファイルを再度確認.
$ ls -lah /tmp/macosinstaller.dmg🆑
-rw-r--r-- 1 ujpadmin wheel 15G 11 30 14:50
/tmp/macosinstaller.dmg
$
- このままファイルを/tmpに置いていると,そのうち消えてしまうので適切な場所に移動する.