Skip to content

Instantly share code, notes, and snippets.

@papapana
Forked from cetinajero/macos_boot_keys.md
Created October 30, 2021 21:25
Show Gist options
  • Select an option

  • Save papapana/e519c0c25719a7b851c9dda454eaf54f to your computer and use it in GitHub Desktop.

Select an option

Save papapana/e519c0c25719a7b851c9dda454eaf54f to your computer and use it in GitHub Desktop.
macOS Boot combination keys and bootable USB commands

macOS Boot combination keys

Keys Description
Startup Manager
Safe mode
D Apple Diagnostics
+ D Apple Diagnostics over Internet
+ V Verbose mode
+ S ó + R Single-user mode
+ R Install the latest macOS that was installed on your Mac
+ + R Upgrade to the latest macOS compatible with your Mac
+ + + R Install the original macOS, or closest still available
+ + P + R Reset NVRAM or PRAM
T Target Disk

Reset a macOS user password

Open the Terminal.app from within macOS Recovery ( + R) and type:

resetpassword

Burn a CD/DVD from an ISO file

hdiutil burn image.iso

Create a UEFI bootable USB from an ISO file

diskutil list
diskutil eraseDisk MS-DOS "WIN10HSL" MBR disk2
hdiutil mount ~/Downloads/Win10_1703_SingleLang_SpanishMexico_x64.iso
cp -rp /Volumes/CSLA_X64FREO_ES-MX_DV5/* /Volumes/WIN10HSL/
hdiutil unmount /Volumes/WIN10HSL/

Create a MBR bootable USB from an ISO file

Format the USB

diskutil list
diskutil partitionDisk /dev/disk2 1 MBR FAT32 W10_1909SPA R

Set the partition as active (boot flag)

sudo fdisk -e /dev/disk2

Enter the following:

Enter 'help' for information
fdisk: 1> flag 1
Partition 1 marked active.
fdisk:*1> write
Device could not be accessed exclusively.
A reboot will be needed for changes to take effect. OK? [n] y
Writing MBR at offset 0.
fdisk: 1> exit
diskutil unmountDisk /dev/disk2

curl https://www.oueta.com/wp-content/uploads/2018/10/syslinux-4.03.tar.gz -o syslinux-4.03.tar.gz
tar -zxvf syslinux-4.03.tar.gz
sudo dd if=syslinux-4.03/mbr/mbr.bin of=/dev/disk2 bs=440 count=1

curl https://raw.githubusercontent.com/unetbootin/unetbootin/master/src/unetbootin/unetbootin.app/Contents/Resources/syslinux-mac -o syslinux-mac
chmod +x syslinux-mac
sudo ./syslinux-mac -i /dev/disk2s1

mkdir /Volumes/W10_1909SPA/syslinux
cp syslinux-4.03/com32/modules/*.c32 /Volumes/W10_1909SPA/syslinux
echo -e "default boot\nLABEL boot\nMENU LABEL boot\nCOM32 chain.c32\nAPPEND fs ntldr=/bootmgr\n" > /Volumes/W10_1909SPA/syslinux/syslinux.cfg

hdiutil mount ~/Downloads/Win10_1909_Spanish\(Mexico\)_x64.iso -mountpoint /Volumes/ISO
cp -Rpv /Volumes/ISO/ /Volumes/W10_1909SPA/
diskutil unmountDisk /dev/disk2

Configure Windows Installer to always ask for the version to install

echo -e "[Channel]\nRetail" > /Volumes/WIN10HSL/sources/ei.cfg

Get the Windows activation key from the BIOS

Windows: wmic path softwarelicensingservice get OA3xOriginalProductKey

GNU Linux: sudo hd /sys/firmware/acpi/tables/MSDM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment