將Macos Catalina放入流浪盒子中。
一些序列縮短了。原始運行時間14.5分鐘。
支持在“ vmware_fusion”,“ vmware_desktop”,“ Parallels”或“ VirtualBox”格式中創建框。
需要以下軟件。除了提到的版本外,其他版本可能會起作用,但這些是經過測試的最新版本。
要啟動macinbox創建的框,您將需要Vagrant:
要創建一個盒子,您將需要MacOS安裝程序應用程序。如果您使用的是Catalina主機,則必須使用Catalina安裝程序:
Catalina主機無法更早使用(例如MacOS 10.14 Mojave)安裝程序,而Mojave主機不能使用Catalina安裝程序。
如果您使用的是Mojave主機,則應使用Mojave安裝程序:
建議您在主機和安裝程序中使用相同的版本,但是MacOS安裝程序的先前版本(例如MacOS 10.13 High Sierra)也可能與Mojave Hosts一起使用,反之亦然。
注意:如果您對虛擬化MACOS的允許性有疑問,則可能需要查看您使用的虛擬化軟件的文檔以及MacOS的軟件許可協議。
需要以下虛擬化應用程序之一:
要在“ vmware_fusion”或“ vmware_desktop”格式中創建並引導一個框:您需要:
要在“相似之處”格式中創建和引導一個框,您需要:
要在“ VirtualBox”格式中創建和引導一個框:您需要:
安裝寶石:
$ sudo gem install macinbox
使用sudo和無參數運行, macinbox工具將創建並添加一個名為“ MacInbox”的VMware框,該框將全屏啟動到“ Vagrant”用戶的桌面:
$ sudo macinbox
請耐心等待,因為這可能需要一段時間。 (在2.5 GHz MacBookPro11,5上,大約需要11分30秒。)工具完成後,您可以使用盒子創建一個新的流浪環境並開始:
$ vagrant init macinbox && vagrant up
運行此命令後的片刻,您會看到虛擬機的顯示器顯示完整的屏幕。 (按Command-Control-F將其退出全屏模式。)虛擬機完成啟動(大約1-2分鐘)後,您將看到“ Vagrant”用戶的桌面,並可以開始使用虛擬機。
要創建一個Parallels桌面框,請傳遞--box-format選項:
$ sudo macinbox --box-format parallels
要查看高級選項,請傳遞--help選項:
Usage: macinbox [options]
--box-format FORMAT Format of the box (default: vmware_desktop)
-n, --name NAME Name of the box (default: macinbox)
-d, --disk SIZE Size (GB) of the disk (default: 64)
-t, --fstype TYPE Type for disk format (default: APFS)
-m, --memory SIZE Size (MB) of the memory (default: 2048)
-c, --cpu COUNT Number of virtual cores (default: 2)
-s, --short NAME Short name of the user (default: vagrant)
-f, --full NAME Full name of the user (default: Vagrant)
-p, --password PASSWORD Password of the user (default: vagrant)
--installer PATH Path to the macOS installer app
--installer-dmg PATH Path to a macOS installer app disk image
--vmware PATH Path to the VMware Fusion app
--parallels PATH Path to the Parallels Desktop app
--user-script PATH Path to user script
--no-auto-login Disable auto login
--no-skip-mini-buddy Show the mini buddy on first login
--no-hidpi Disable HiDPI resolutions
--no-fullscreen Display the virtual machine GUI in a window
--no-gui Disable the GUI
--use-qemu Use qemu-img (vmware_desktop only)
--verbose Enable verbose mode
--debug Enable debug mode
-v, --version
-h, --help
啟用調試模式會導致中間文件(磁盤映像,VMDK和框)在工具退出後保存而不是清理。警告! ! !這些中間文件非常大,使用此選項時,您可以很快用光磁盤空間。
這個高級示例創建並添加了一個名為“ Macinbox-large-nogui”的盒子,帶有4個內核,8 GB或RAM和一個128 GB磁盤;關閉自動登錄;並防止啟動VM時顯示VMware GUI:
$ sudo macinbox -n macinbox-large-nogui -c 4 -m 8192 -d 128 --no-auto-login --no-gui
如果您的vagrant_home環境變量集,並希望將創建的框添加到該位置的“框”目錄中,則需要告訴Sudo將其傳遞到MacInbox,例如:
$ sudo "VAGRANT_HOME=${VAGRANT_HOME}" macinbox
默認情況下, macinbox將配置Guest OS以啟用HIDPI分辨率,並配置虛擬機以使用本機顯示分辨率。您可以使用--no-hidpi選項禁用此行為。
默認情況下, macinbox將使用預安裝的VMware工具的“ VMware_desktop”格式創建一個Vagrant Box。
當使用--box-format選項設置框格式為“相似之處”時,則將Parallels工具預先安裝。
當盒子格式設置為“ VirtualBox”時,未安裝訪客擴展名。請注意,某些功能對VirtualBox的行為不同。屏幕分辨率設置為1280x800,不支持HIDPI分辨率。除非使用--no-hidpi選項,否則GUI量表因子設置為2.0(使VM在帶有視網膜顯示屏的主機上正確顯示)。最後,默認情況下啟用了SSH端口 - 端口,以便主機可以連接到來賓。
如果需要其他框自定義,則可以使用--user-script選項指定用戶腳本。該腳本是在安裝OS之後運行的,並將為安裝位置的第一個也是唯一的參數提供通往安裝位置的路徑。該腳本必須是可執行的,並且以零代碼退出,否則將中止框創建。
--installer-dmg選項允許您指示包含MacOS安裝程序的磁盤映像的路徑,並覆蓋--installer選項。指定的磁盤圖像尚未安裝; macinbox將根據需要安裝並卸載它。此功能允許您使用installinstallmacos.py創建的安裝程序磁盤圖像作為macinbox Workflow的一部分。
該工具執行以下操作:
該工具創建的框包括一個內置的vagrantfile,該盒子可以禁用以下默認的vagrant行為:
為了重新啟用默認的SSH端口轉發,您可以將以下行添加到環境的VagrantFile:
config.vm.network :forwarded_port, guest: 22, host: 2222, id: "ssh"
要重新啟用默認同步文件夾,您可以將以下行添加到環境的VagrantFile:
config.vm.synced_folder ".", "/vagrant"
該工具旨在在第一個啟動之前完成所有需要完成的MacOS需要完成的操作,以將其變成帶有無縫用戶體驗的Vagrant盒子。但是,此工具還旨在進行最少的配置。沒有做任何事情可以將其推遲到VagrantFile或Packer模板中的配置步驟。
這個項目的靈感來自其他人的偉大作品:
該項目從機器人先生的一集中汲取了靈感。在這一集中,艾略特(Elliot)被迅速啟動,啟動似乎是運行新鮮Linux桌面環境的虛擬機,以檢查不受信任的CD-ROM的內容。正如我看著的那樣,我想:“我希望能夠與Macos一起做這種事情!”。當然,我不是唯一從Internet下載不信任軟件的人,並希望有一種簡單的方法可以對其進行評估而不會使我的主要工作環境處於危險之中?
該項目是我的Vagrant-Box-Macos項目的直接繼任者,該項目本身受到Tim Sutton的OSX-VM-Templates項目的重大啟發。
隨著MACOS 10.12.4的發布,定制MacOS安裝的主要技術受到了新的安裝程序要求,即Apple簽署了所有軟件包。在嘗試允許vagrant-box-macos支持MacOS 10.13 High Sierra之後,我決定需要另一種方法來創建盒子, macinbox誕生了。
首先運行sudo gem install bundler和bundle install 。
要直接從GIT工作區的根部運行macinbox ,而無需安裝GEM,請運行sudo bundle exec macinbox 。
要將此寶石安裝到本地計算機上,請運行sudo bundle exec rake install 。
您還可以運行bin/console以獲得交互提示,該提示可以讓您進行實驗。例如:
opts = Macinbox::CLI::DEFAULT_OPTION_VALUES
opts[:collector] = Macinbox::Collector.new
opts[:full_name] = "Vagrant"
opts[:password] = "vagrant"
opts[:image_path] = "macinbox.sparseimage"
opts[:boxes_dir] = File.expand_path "~/.vagrant.d/boxes"
$debug = $verbose = true
include Macinbox::Actions
opts[:macos_version] = CheckMacosVersions.new(opts).run
CreateImageFromInstaller.new(opts).run
opts[:vmdk_path] = "macinbox.vmdk"
CreateVMDKFromImage.new(opts).run
opts[:box_format] = "vmware_desktop"
opts[:box_path] = "vmware_desktop.box"
CreateBoxFromVMDK.new(opts).run
InstallBox.new(opts).run
opts[:hdd_path] = "macinbox.hdd"
CreateHDDFromImage.new(opts).run
opts[:box_format] = "parallels"
opts[:box_path] = "parallels.box"
CreateBoxFromHDD.new(opts).run
InstallBox.new(opts).run
opts[:vdi_path] = "macinbox.vdi"
CreateVDIFromImage.new(opts).run
opts[:box_format] = "virtualbox"
opts[:box_path] = "virtualbox.box"
CreateBoxFromVDI.new(opts).run
InstallBox.new(opts).run
opts[:collector].cleanup!
要發布新版本,請在version.rb中更新版本號,然後運行bundle exec rake release Release ,該版本將為版本創建一個git標籤,推送git consits and tags,然後將.gem文件推到rubygems.org。
歡迎在https://github.com/bacongravy/macinbox上的GitHub上的錯誤報告和拉動請求。