If you experience a hard drive failure and need to re-install the Mac OS X operating system, you can create a USB install media.
You need a working Mac and a minimum of an 8GB USB pen drive.
- On a working Mac running Yosemite go to the AppStore and download Yosemite.
- Plug in the USB and format it using Mac OS X (Journaled) with a GUID partition scheme – leave the name as Untitled
- Open ‘Terminal’
- Use the following command
sudo /Applications/Install OS X--volume /Volumes/Untitled --applicationpath /Applications/Install OS X --nointeraction
It takes a good 20 minutes to complete and once finished, in the ‘Terminal’ app, you will see the line
Copy complete. Done.
Put the USB drive into the Mac you want to install on and when it boots hold down the alt key and choose your USB drive.