Skip to content

Instantly share code, notes, and snippets.

@Lost-Entrepreneur439
Last active March 9, 2025 17:20
Show Gist options
  • Save Lost-Entrepreneur439/7295e24a5684eba15dad4f74dac02c54 to your computer and use it in GitHub Desktop.
Save Lost-Entrepreneur439/7295e24a5684eba15dad4f74dac02c54 to your computer and use it in GitHub Desktop.
EFI mounting script for legacy Mac OS X versions (such as Snow Leopard)
#!/bin/bash
echo "Available EFI Partitions:"
diskutil list | awk '/EFI/ {print NR-1, "->", $NF, $0}' # Assigns a number to each EFI partition
# Get user selection
echo "\nEnter the number of the EFI partition you want to mount:"
read -r SELECTION
# Get the actual disk identifier
diskutil list | awk '/EFI/ {print $NF}' | sed -n "$((SELECTION+1))p" > /tmp/efi_disk
DISK_ID=$(cat /tmp/efi_disk)
rm /tmp/efi_disk
# Validate input
if [ -z "$DISK_ID" ] || [ ! -e "/dev/$DISK_ID" ]; then
echo "Invalid selection. Exiting."
exit 1
fi
# Create mount point if it doesn't exist
MOUNT_POINT="/Volumes/EFI"
if [ ! -d "$MOUNT_POINT" ]; then
sudo mkdir "$MOUNT_POINT"
fi
# Mount EFI partition
sudo mount_msdos "/dev/$DISK_ID" "$MOUNT_POINT"
echo "EFI partition mounted at $MOUNT_POINT"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment