Version: OS X Big Sur 11.3.1
Build Version: 20E241
Provider: VirtualBox
Created with https://github.com/myspaghetti/macos-virtualbox, with the following changes:
- upgraded to macOS Big Sur (11.3.1)
- removed the recovery partition
- installed Homebrew
- 4 GB of memory
- 2 CPUs
- 125 GB dynamically-allocated disk (19.28 GB using by operation system)
- Xcode Command Line Tools (version 2384)
- Homebrew (version 3.1.5)
- Install Oracle VM VirtualBox
- Install Oracle VM VirtualBox Extension Pack
- Install Vagrant
Note: Default download location of boxes: ~/.vagrant.d/boxes. You can change it via the VAGRANT_HOME
environment variable.
Note: Don't forget to disable Hyper-V on Windows, you can use bcdedit /set hypervisorlaunchtype off
command. You can revert it using bcdedit /set hypervisorlaunchtype auto
command if you don't want to use this setup.
# Create a folder and go into it
$ mkdir macos-big-sur && cd macos-big-sur
# Download necessary Vagrant box
$ vagrant init amarcireau/macos --box-version 11.3.1
The NVRAM file packaged with this Vagrant box must be copied manually after importing it into Virtualbox. The following Vagrantfile performs the copy and suppresses guest additions and shared directory warnings (which are not supported by Big Sur guests):
ENV["VAGRANT_EXPERIMENTAL"] = "typed_triggers"
Vagrant.configure("2") do |config|
config.vm.box = "amarcireau/macos"
config.vm.box_version = "11.3.1"
# Synced folder are not supported under Mac OS X
# BSD-based guests do not support the VirtualBox filesystem
config.vm.synced_folder ".", "/vagrant", disabled: true
# VM Customizations go here
config.vm.provider "virtualbox" do |v|
# By default Vagrant will check for the VirtualBox Guest Additions when starting a machine,
# and will output a warning if the guest additions are missing or out-of-date.
# If TRUE (default) check if guest have guest additions installed
v.check_guest_additions = false
# Memory and CPU settings
v.memory = 4096 # 4GB
v.cpus = 2
end
config.trigger.after :"VagrantPlugins::ProviderVirtualBox::Action::Import", type: :action do |t|
t.ruby do |env, machine|
FileUtils.cp(
machine.box.directory.join("include").join("macOS.nvram").to_s,
machine.provider.driver.execute_command(["showvminfo", machine.id, "--machinereadable"]).
split(/\n/).
map {|line| line.partition(/=/)}.
select {|partition| partition.first == "BIOS NVRAM File"}.
last.
last[1..-2]
)
end
end
end
# Start machine
$ vagrant up
# Connect to machine
$ vagrant ssh
# Show Mac OS X operating system version
> sw_vers
# Stop machine
$ vagrant halt
VirtualBox provides few options to share folder between guest (macOs) and host devices but I can't implement it. Therefore I'm coming a different solution of this subject.
Let's install sshfs-win in your host device.
You can connect to guest (macOs) via a SSHFS client software like SSHFS Win Manager.
Or add a new network location using Windows itself via \\sshfs\vagrant@127.0.0.1!2222
connection string.
start:macOS
Shortcut Target: C:\Cmder\Cmder.exe /task start:macOS
*cmd.exe -cur_console:d:"D:\vagrant-os\macos-big-sur":t:macOS /k "%ConEmuDir%\..\init.bat && vagrant up && powershell -File D:\cloud\scripts\notification.ps1 Info "Machine Started" "Virtual machine running." && exit"
stop:macOS
Shortcut Target: C:\Cmder\Cmder.exe /task stop:macOS
*cmd.exe -cur_console:d:"D:\vagrant-os\macos-big-sur":t:macOS /k "%ConEmuDir%\..\init.bat && vagrant halt && powershell -File D:\cloud\scripts\notification.ps1 Error "Machine Stopped" "Virtual machine stopped." && exit"
ssh:macOS
Shortcut Target: C:\Cmder\Cmder.exe /task ssh:macOS
*cmd.exe -cur_console:d:"D:\vagrant-os\macos-big-sur":t:macOS /k "%ConEmuDir%\..\init.bat" && vagrant ssh
status:macOS
Shortcut Target: C:\Cmder\Cmder.exe /task status:macOS
*cmd.exe -cur_console:n:d:"D:\vagrant-os\macos-big-sur":t:macOS /k ""%ConEmuDir%\..\init.bat" && vagrant status | grep -q "is running" && powershell -File D:\cloud\scripts\notification.ps1 Info "Machine Running" "Virtual machine running." || powershell -File D:\cloud\scripts\notification.ps1 Error "Machine Stopped" "Virtual machine stopped." & exit"
notification.ps1
[void] [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")
$icon = $args[0] # Info, Error, None and Warning
$title = $args[1]
$message = $args[2]
$objNotifyIcon = New-Object System.Windows.Forms.NotifyIcon
$objNotifyIcon.Icon = [System.Drawing.SystemIcons]::Information
$objNotifyIcon.BalloonTipIcon = $icon
$objNotifyIcon.BalloonTipText = $message
$objNotifyIcon.BalloonTipTitle = $title
$objNotifyIcon.Visible = $True
$objNotifyIcon.ShowBalloonTip(2500)
- For troubleshooting refer to https://github.com/myspaghetti/macos-virtualbox
- Box used is: https://app.vagrantup.com/amarcireau/boxes/macos/versions/11.3.1
- Tested on Windows 10 - VirtualBox 6.1.22