LoginSignup
15
28

More than 5 years have passed since last update.

VirtualBoxにmacOS Sierraの仮想マシンをつくってみた

Last updated at Posted at 2016-12-30

ぼくのやりたいこと

macOS用の自動プロビジョニングをテストするために仮想のmac環境がほしいなーと思ったのです。

ぼくがやったこと

こちらまさたか日記さんの記事 が神でした。

あらかじめAppStoreからmacOS SierraのインストールAppをダウンロードしておいてください。

ダウンロード時期によってインストールAppの名前が違うみたいなので Install OS X Sierra.app => Install macOS Sierra.app/ と読み替えましょう。

$ hdiutil attach "/Applications/Install macOS Sierra.app/Contents/SharedSupport/InstallESD.dmg" -noverify -nobrowse -mountpoint /Volumes/esd
$ hdiutil create -o Sierra.cdr -size 7316m -layout SPUD -fs HFS+J
$ hdiutil attach Sierra.cdr.dmg -noverify -nobrowse -mountpoint /Volumes/iso
$ asr restore -source /Volumes/esd/BaseSystem.dmg -target /Volumes/iso -noprompt -noverify -erase
$ rm /Volumes/OS\ X\ Base\ System/System/Installation/Packages
$ cp -rp /Volumes/esd/Packages /Volumes/OS\ X\ Base\ System/System/Installation
$ cp -rp /Volumes/esd/BaseSystem.chunklist /Volumes/OS\ X\ Base\ System/
$ cp -rp /Volumes/esd/BaseSystem.dmg /Volumes/OS\ X\ Base\ System/
$ hdiutil detach /Volumes/esd
$ hdiutil detach /Volumes/OS\ X\ Base\ System
$ hdiutil convert Sierra.cdr.dmg -format UDTO -o Sierra.iso
$ mv Sierra.iso.cdr Sierra.iso 
$ rm Sierra.cdr.dmg

ぼくがはまったところ

上述したコードの一番最初、

$ hdiutil attach "/Applications/Install macOS Sierra.app/Contents/SharedSupport/InstallESD.dmg" -noverify -nobrowse -mountpoint /Volumes/esd

でハマっちゃう人が結構多いみたい。 Resource Busy とか出ちゃう。なので

$ cp -a "/Applications/Install macOS Sierra.app/Contents/SharedSupport/InstallESD.dmg" .

InstallESD.dmg を退避させてみる。ぼくはこれでいけた。

あとなんかよくわからないけど、スクリプトを一箇所順番が前後して実行してしまったら色々とエラーが出ちゃったので、もう一回最初からやったらいけた。まあいっか。

ぼくがつくったISOをVirtualBoxにのせる

VirtualBoxを起動したら新規追加から Mac OS X(64bit) を選択して、メモリとかストレージとか値は適当に(デフォルトでいいと思う)決めて進んでみる。

起動すると初回に使用するイメージファイルを聞かれるので、先ほど作った Sierra.iso を選択してGO。

すきなようにあそぶ

さあここからは秀麗なUXがぼくらをmacOSの世界へ連れて行ってくれるね!!!

追記(20161230)
(まさたか日記さんにも書いてありますが、インストールディスクの選択のところはちょっとぼくらを悩ませます。まさたか日記さんを参考にしてください。)
追記終わり

さんこうしりょう

この最後の記事には、ISOファイルをどこからかダウンロードしちゃうっていう方法が紹介されている。それもよしですね。

15
28
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
15
28