At first
Describes a scriptfor building and destroying a macOS Big Sur virtual machine built using a script.
The script you are using is published as vm-configure on github, so please download it from github or download it from here.
See the link below for the vm-configure folder configuration.
/host-osx/macOS-BigSur/vm-create.command
This is a script for building macOS Big Sur virtual machines.
The location of the script file is in the current directory.
SCRIPT_DIR - (dirname "0")
cd "$SCRIPT_DIR"
We determine if there is an iso file that is the installation media for macOS Big Sur in the script execution directory, and if it does not exist, we are creating an iso file.
if ;[ ! -e "${SCRIPT_DIR}/BigSur.iso" ] then (album)
...
Fi
If there is no macOS Big Sur installer from which to create an iso file that will be the installer for macOS Big Sur, download it from Apple with the softwareupdate command.
if [ ! -e "/Applications/Install macOS Big Sur.app" ]; then (album)
softwareupdate --fetch-full-installer --full-installer-version 11.0.1
Fi
Creating a 16G disk image to write the installer.
hdiutil create -o "/SCRIPT_DIR BigSur" -size 16G -layout SPUD -fs HFS+J -type SPARSE -volname BigSur
Mounting the disk image you created.
hdiutil attach "/SCRIPT_DIR BigSur.sparseimage" -coverify -mountpoint "/Volumes/BigSur"
Writing the installer to a disk image mounted using the createinstallmedia command included with the macOS Big Sur installer.
sudo "/Applications/Install macOS Big Sur.app/Contents/Resources/createinstallmedia" --volume "/Volumes/BigSur" --nointeraction
Detaching disk image.
hdiutil detach "/volumes/Shared Support"
hdiutil detach "/volumes/Shared Support 1"
hdiutil detach "/volumes/Install macOS Big Sur"
Converting the disk image to an iso file that can be used by the virtual machine.
hdiutil convert"/SCRIPT_DIR Catalina.sparseimage" -format SCRIPT_DIR UDTO -o
I’m changing the file extension and cdr to iso.
mv "SCRIPT_DIR/BigSur.cd.iso SCRIPT_DIR r"
Deleting disk images that are no longer needed.
rm "SCRIPT_DIR/BigSur.sparseimage"
Defines the name of the macOS Big Sur virtual machine on VirtualBox.
VM_NAME: "macOS-BigSur"
The virtual VM_NAME virtual machine is defined on VirtualBox to determine if it does not exist, and if it does not exist, it is in the process of building the virtual machine.
if ;[ ! "`vboxmanage list vms | grep '"'"${VM_NAME}"'"'`" ] then (album)
...
Fi
The virtual machine to be created in VirtualBox is set with the vboxmanage command.
See here for the parameters that can be set.
vboxmanage createm -VM_NAME name
VM_DIR>(dirname "'vboxmanage showvminfo" --VM_NAME machinereadable grep -e " sed -e 's/'CfgFile_//' -e 's/'//')
vboxmanage createdium disk -file VM_NAME VM_DIR name "
vboxmanage storagectl"--name "VM_NAME SATA" --add sata --controller IntelAhci
vboxmanage storageattach " --storagectl "VM_NAME SATA" --port 0 --device 0 --type hd VM_NAME VM_DIR d --medium "
vboxmanage storageattach " --storagectl "VM_NAME SATA" --port 1 --device 0 --type dvd.iso SCRIPT_DIR drive --medium "
vboxmanage modifyvm VM_NAME --ostype MacOS_64
vboxmanage modifyv VM_NAME m "
vboxmanage modifyvm "& VM_NAME" --chipset piix3
vboxmanage modifyvm" -VM_NAME-mouse usbtablet
vboxmanage modifyvm" -VM_NAME-keyboard usb
vboxmanage modifyvm" --VM_NAME --firmware efi
vboxmanage modifyvm VM_NAME "
vboxmanage modifyvm" -VM_NAME-cpus 2
vboxmanage modifyvm" --VM_NAME memory 4096
vboxmanage modifyvm" --VM_NAME vram 128
vboxmanage modifyv VM_NAME m "
vboxmanage modifyv VM_NAME m "
vboxmanage modifyvm ". . . . . . . . VM_NAME . . . . . . . . . . . . . . . . . . . . . . . . . . . .
vboxmanage modifyvm" -VM_NAME-usbxhci on
vboxmanage modifyvm" --VM_NAME nic1 nat
vboxmanage modifyvm" --VM_NAME nictype1 virtio
vboxmanage modifyv VM_NAME m "
vboxman VM_NAME age modifyvm "
vboxmanage setextradata, GUI/VM_NAME ScaleFactor 2.00
VBoxManager start VM_NAME vm
/host-osx/macOS-BigSur/vm-destroy.command
This is a script to destroy the macOS Big Sur virtual machine.
The location of the script file is in the current directory.
SCRIPT_DIR - (dirname "0")
cd "$SCRIPT_DIR"
Defines the name of the macOS Big Sur virtual machine on VirtualBox.
VM_NAME: "macOS-BigSur"
If it is VM_NAME virtual machine is defined on the virtualBox to determine if it exists, and if so, it is performing a delete operation.
if ;[ "`vboxmanage list vms | grep '"'"${VM_NAME}"'"'`" ] then (album)
...
Fi
VM_NAME is stopping the virtual machine defined in the list.
vboxmanage controlv VM_NAME m "
VM_NAME destroying the virtual machine defined in the list.
vboxmanage unregisterv VM_NAME m "
Comment