Skip to content

Instantly share code, notes, and snippets.

@esutton
Created October 24, 2019 19:36
Show Gist options
  • Save esutton/374b84f92f7e552dd69d766ab7248f04 to your computer and use it in GitHub Desktop.
Save esutton/374b84f92f7e552dd69d766ab7248f04 to your computer and use it in GitHub Desktop.
Create bootable USB installer for vSphere ESXi Using MacOS
#!/bin/bash
#
#
# Create bootable USB installer for vSphere ESXi on macOS
# 1) Boot using the resulting installer
# 2) Install ESXi to a second high-speed USB 3.0 device
# 3) Make a copy of the installed USB ESXi for emergencies
#
# https://github.com/cbednarski/vmware-usb-osx
#
# Determine your USB stick device disk
# Example: /dev/disk2 (external, physical):
#
# *** Warning: Make sure it displays "external" *not* internal and matches size of your USB device
# Tip: Rename your USB stick device disk to "usb-esxi" to help locate
echo "devices:"
diskutil list
UsbDevice=/dev/disk2
echo "Create esxi.img.dmg:"
hdiutil convert -format UDRW -o esxi.img esxi.iso
echo "vmware: esxi.img.dmg"
# Format USB device as a bootable MS-DOS volume
diskutil unmountDisk ${UsbDevice}
diskutil eraseDisk MS-DOS ESXI MBR ${UsbDevice}
# Mount USB device to add syslinux.cfg
mkdir -p source
mkdir -p target
hdiutil mount esxi.iso -mountpoint ./source
cp -r source/ /Volumes/ESXI/
cp syslinux.cfg /Volumes/ESXI/
hdiutil eject ./source
diskutil unmountDisk ${UsbDevice}
diskutil eject ${UsbDevice}
echo -ne '\007'
echo -ne '\007'
echo -ne '\007'
echo
echo "**************"
echo "* D o n e *"
echo "**************"
echo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment