Failed to make bootable USB drive and now I can't even format it I want to do a fresh install of Yosemite and I got a brand new 8GB flash drive and I followed this tutorial. I formatted the USB drive and was copying the Yosemite installer, however I got the following error

Copying installer files to disk...
The copy of the installer app failed.


Great. So I tried to reformat the drive again and start over. No. Disk utility says I can't format it because it "cannot unmount the drive". What does that suppose to mean? Then I plug the USB drive to a Windows computer and tried my luck there. No, you can't format the drive because it's "write protected" (there's no physical write protection switch on the drive or anything). Oh dear so now the drive is completely ruined? How can I force format the drive?





Now in the terminal I used sudo diskutil unmountDisk force disk1 to successfully unmount the drive, but still I can't format it! Disk utility gave me a new error "Unable to write to the last block of the device."
It happened to me also you simply need to paste this commands in your Terminal, these commands ignores these errors and formats the Disks successfully no need to go to Disk Utility these commands will also create the bootable drive

Note: These commands are for macOS Sierra/High Sierra do the changes as per your needs! (This also works for any Previous version of macOS)

First you would need to download macOS Sierra Installer(Whichever OS you want),

Then you would have to make a bootable disk containing the Install macOS Sierra.app (Whichever OS you want)

I am also providing you a link to a YouTube video which will help you in creating the bootable USB stick link: https://www.youtube.com/watch?v=v4H5hKuI7yg&amp;t=130s

I am also adding the command required to create the bootable disk:

sudo (path to the create install media file under installer.app&gt;Contents&gt;Resources) --volume {path to the USB stick (You are trying to make bootable)} —applicationpath (path to your Install macOS sierra.app)


e.g:

sudo /Applications/Install\ macOS\ Sierra.app/Contents/Resources/createinstallmedia --volume /Volumes/MyVolume --applicationpath /Applications/Install\ macOS\ Sierra.app


Please make the necessary changes as per your files and volumes