Skip to content

Instantly share code, notes, and snippets.

@egatjens
Last active October 25, 2023 21:06
Show Gist options
  • Save egatjens/99800d383e8afecf148ee4907275061e to your computer and use it in GitHub Desktop.
Save egatjens/99800d383e8afecf148ee4907275061e to your computer and use it in GitHub Desktop.
Make a bootable USB drive

Create bootable linux distro

diskutil list
diskutil unmountDisk /dev/disk#
sudo dd if=/path/to/linux_iso of=/dev/disk# bs=1m
# or for debian
$ sudo dd if=/path/to/linux_iso of=/dev/disk# bs=4M; sync 
# Wait till finished
# Ctrl + T for status updates.
# When the poppup window appears, run cmd below and then click ignore.
diskutil eject /dev/disk#

Create a bootable USB stick on mac from iso

$ diskutil list
$ diskutil unmountDisk /dev/diskN
$ sudo dd if=/path/to/downloaded.iso of=/dev/diskN bs=1m
# after finish and popup appears
$ diskutil eject /dev/diskN

Create a bootable USB stick on mac from dmg

https://www.fonepaw.com/upgrade/create-bootable-macos-usb-drive.html

Sierra

sudo /Applications/Install\ macOS\ Sierra.app/Contents/Resources/createinstallmedia --volume /Volumes/FlashInstaller --applicationpath /Applications/Install\ macOS\ Sierra.app --nointeraction
Mac startup key combinations

https://support.apple.com/en-us/HT201255

Mac - Remove attributes from file/folder

https://stackoverflow.com/a/70616990

Make a bootable USB drive for windows option #1

export DRIVE_MOUNT=/dev/disk2
export DRIVE_NAME="WINSTALL"

# format
diskutil eraseDisk MS-DOS $DRIVE_NAME MBR $DRIVE_MOUNT

# Mount the ISO File
hdiutil mount /Users/your-username/Downloads/Windows.iso

# Copy Files to the USB
export WIN_VOLUME="/Volumes/J_CCSA_X64FRE_EN-GB_DV5"
rsync -vha --exclude=sources/install.wim /Volumes/$WIN_VOLUME/* /Volumes/$DRIVE_NAME

# Copy install.wim to the USB
wimlib-imagex split /Volumes/$WIN_VOLUME/sources/install.wim /Volumes/$DRIVE_NAME/sources/install.swm 4000

# Unmount
diskutil unmount $DRIVE_MOUNT 

Reference

Make a bootable USB drive for windows option #2

diskutil list
# USB drive must be formatted with a FAT32 partition and the MBR partitioning scheme
sudo diskutil eraseDisk FAT32 "WINDOWS10" MBRFormat /dev/disk#
# Mount Windows iso on finder.
# Copy the files to the USB stick
cp -rp /Volumes/CCCOMA_X64FRE_EN-US_DV9/* /Volumes/WINDOWS10/
# wait till finished
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment