- Restart in single mode (turn off, turn on and press "Command+S").
- When the prompt appears connect the external USB drive.
- Look for available disk drives. Most likely it will be the last one listed. In my case I had the internal drive, a USB stick and an external USB hard drive:
# ls -l /dev/disk* ... /dev/disk2s2
- Now let us find the file system type. In my case it is a MAC Hierarchical File System (HFS)
# fstyp /dev/disk2s2 hfs
- To mount the drive we need write permissions. That is why we run the first command below. Needless to say you need to be careful from now on ...
# mount -uw / # mkdir /extdrive # mount -t hfs /dev/disk2s2 /extdrive
- Backup what you need. For examplehere are some directories I backed up today:
# cp -pr /Users/nestor/Downloads /extdrive/ # cp -pr /Users/nestor/Documents /extdrive/ # cp -pr /Users/nestor/Pictures /extdrive/ # cp -pr /Users/nestor/Movies /extdrive/ # cp -pr /Users/nestor/Desktop /extdrive/ # cp -pr /Users/nestor/Library/Mail /extdrive/
- Unmount and shutdown (or restart):
# umount /extdrive/ # shutdown -h now
Bootable OSX USB DriveIf you do not have an OSX bootable USB drive you will need to make one from a healthy MAC:
- From the App Store search and download OS X. When you get to the below screen do not interact with it, that way the installer remains in the Applications directory. Just move on to the next step.
- Format a USB drive from "Disk Utility" using option "MAC OSX Extended (Journaled)" which will format the drive using HFS. Do not bother changing the name as it will be changed anyway as part of the below step.
- Run the below from Terminal (assuming the USB was formatted using the default 'untitled' name. Note that the command below corresponds to Mavericks. You probably will have to deal with a different version like El Capitan (/Applications/Install\ OS\ X\ El\ Capitan.app/Contents/Resources/createinstallmedia) :
$ sudo /Applications/Install\ OS\ X\ Mavericks.app/Contents/Resources/createinstallmedia --volume /Volumes/untitled --applicationpath /Applications/Install\ OS\ X\ Mavericks.app --nointeraction Erasing Disk: 0%... 10%... 20%... 30%...100%... Copying installer files to disk... Copy complete. Making disk bootable... Copying boot files... Copy complete. Done.
Reinstall OS X
- Turn off the target MAC, insert the Bootable OSX USB Drive, turn on keeping the Option key pressed to be able to select from where to boot. BTW click here for more OSX startup options.
- From the options choose Disk Utility and select the "Macintouch HD". Click on Verify and if needed click on Repair Disk after. This is a crucial step. Errors like "this disk is lock" will be avoided later on. If the disk is damaged there is no need to keep trying as a replacement most likely will be needed.
- WARNING: This step erase the whole disk so I assume you have a backup or this is a blank disk. Just click on Erase and select as format "MAC OS Extended (Case-sensitive, journaled)". You might want to pick the "MAC OS Extended (Case-sensitive, journaled, Encrypted)" option. Conform you want to "Erase"
- NOw that the disk is formatted go to the menu and close the Disk Utility. Click on Install OSX, select the disk and continue with the installation. After some minutes your new OSX will be ready.