Skip to content

Instantly share code, notes, and snippets.

@macsimom
Created August 22, 2019 09:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save macsimom/47be8b00f561cf17ed3547474db3b53b to your computer and use it in GitHub Desktop.
Save macsimom/47be8b00f561cf17ed3547474db3b53b to your computer and use it in GitHub Desktop.
Partially automatable script to get Catalina Beta 6 up and running VMware Fusion 11.1.1 using a physical Mac and USB stick
#!/bin/bash
####
#
# Prerequisite: You must have a disk image containing the "Install macOS Catalina Beta.app" for beta 6
# (installinstallmacos.py generates a nice one)
# The disk image must be reachable on an smb share from the final vm
# You must extract the kernel from inside the Core.pkg in InstallESD.dmg located in "Install macOS Catalina Beta.app" and put it on the root of the USB drive
# Pacifist from https://charlessoft.com is indispensable for this operation
# And you must replace a few VARS down below with values of your own: PATHTOBASESYSTEM, PATHTOBASESYSTEMCHUNKLIST, PATHTOUSBSTICK, SHAREUSERNAME ,SHAREHOST, SHARENAME, PATHTOINSTALLINSTALLMACOSIMAGE
#
# run the script with
# sudo bash Beta6.sh
#
###
#!/bin/bash
# Replace VAR values as needed
PATHTOBASESYSTEM="BaseSystem.dmg"
PATHTOBASESYSTEMCHUNKLIST="BaseSystem.chunklist"
PATHTOUSBSTICK="/Volumes/USBSTICK"
mkdir $PATHTOUSBSTICK/com.apple.catalina.booter
hdiutil attach $PATHTOBASESYSTEM
cp /Volumes/macOS\ Base\ System/System/Library/PrelinkedKernels/prelinkedkernel $PATHTOUSBSTICK/com.apple.catalina.booter/prelinkedkernel
cp /Volumes/macOS\ Base\ System/System/Library/CoreServices/boot.efi $PATHTOUSBSTICK/com.apple.catalina.booter/boot.efi
cp /Volumes/macOS\ Base\ System/System/Library/CoreServices/SystemVersion.plist $PATHTOUSBSTICK/com.apple.catalina.booter/SystemVersion.plist
hdiutil detach "/Volumes/macOS Base System"
defaults write $PATHTOUSBSTICK/com.apple.catalina.booter/com.apple.Boot "Kernel Cache" \\\\com.apple.catalina.booter\\\\prelinkedkernel
defaults write $PATHTOUSBSTICK/com.apple.catalina.booter/com.apple.Boot "Kernel Flags" "root-dmg=file:///com.apple.catalina.booter/BaseSystem.dmg -v"
plutil -convert xml1 $PATHTOUSBSTICK/com.apple.catalina.booter/com.apple.Boot.plist
echo "Copying BaseSystem.dmg to USB stick"
cp $PATHTOBASESYSTEM $PATHTOUSBSTICK/com.apple.catalina.booter/BaseSystem.dmg
cp $PATHTOBASESYSTEMCHUNKLIST $PATHTOUSBSTICK/com.apple.catalina.booter/BaseSystem.chunklist
sudo bless -folder $PATHTOUSBSTICK/com.apple.catalina.booter -file $PATHTOUSBSTICK/com.apple.catalina.booter/boot.efi -label CatalinaBooter -verbose
####
#
#
#
###
cat <<'EOF' > $PATHTOUSBSTICK/create_new_prelinkedkernel.sh
#!/bin/bash
mount -uw /Volumes/Image\ Volume
mv /Volumes/Image\ Volume/com.apple.catalina.booter/prelinkedkernel /Volumes/Image\ Volume/com.apple.catalina.booter/prelinkedkernel_apple
kextcache -c /Volumes/Image\ Volume/com.apple.catalina.booter/prelinkedkernel \
-K /Volumes/Image\ Volume/kernel -l \
-- /System/Library/Extensions /System/Library/Extensions/IOACPIFamily.kext
sleep 5
shutdown -h now
EOF
cat <<'EOF' > $PATHTOUSBSTICK/install_beta6.sh
#!/bin/bash
# Replace VAR values as needed
SHAREUSERNAME=superuser
SHAREHOST=hostmac.local
SHARENAME=Shared
PATHTOINSTALLINSTALLMACOSIMAGE=Install_macOS_10.15-19A536g.dmg
mkdir /Volumes/HOST
mount_smbfs "//${SHAREUSERNAME}@${SHAREHOST}/${SHARENAME}" /Volumes/HOST
hdiutil attach /Volumes/HOST/${PATHTOINSTALLINSTALLMACOSIMAGE}
installer -pkg /Volumes/Install\ macOS\ Catalina\ Beta/Install\ macOS\ Catalina\ Beta.app/Contents/SharedSupport/InstallInfo.plist -target /Volumes/Macintosh\ HD -verbose -dumplog
mv /Volumes/Macintosh\ HD\ 1/System/Library/Extensions/AppleIntelMCEReporter.kext /Volumes/Macintosh\ HD\ 1/Users/Shared/AppleIntelMCEReporter.kext
cp /Volumes/Image\ Volume/com.apple.catalina.boot/prelinkedkernel /Volumes/Macintosh\ HD\ 1/System/Library/PrelinkedKernels/prelinkedkernel
shutdown -r now
EOF
diskutil eject $PATHTOUSBSTICK
####
#
# Now boot the USB stick on a physical Mac, open Terminal and run
# bash /Volumes/Image\ Volume/create_new_prelinkedkernel.sh
#
###
####
#
# Create a new custom macOS 10.14 vm in Fusion
# Quit Fusion and run the following command
# sed -i -E $'s/board-id.*/board-id.reflectHost = "FALSE"\\\nboard-id = "VMWAREGUEST"/' [PATH TO VMX FILE IN VMWAREVM BUNDLE]
# Launch Fusion
# and "Power on to firmware" the vm, then insert the USB stick and "enter setup"->"boot from file" [USBSTICK]/com.apple.catalina.booter/boot.efi
# Once booted open Terminal and run
# bash /Volumes/Image\ Volume/install_beta6.sh
#
###
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment