- 
Download Yosemite
 - 
Connect the USB drive ( 8 GB ) to your Mac.
 - 
Using Disk Utility (it is found in Other under Launchpad), format the USB drive as
Mac OS Extended (Journaled), and name itYosemite. This can be done from theErase tabwithin the app; make sure that there are no multiple partitions (turn to the Partition tab to verify and correct this). ChooseGUID Partition Tableas the partition scheme and chooseOK - 
Open Terminal (it is found in the same folder as the
Disk Utility app). - 
Use (paste) the following command:
[If on Yosemite]:
sudo /Applications/Install\ OS\ X\ Yosemite.app/Contents/Resources/createinstallmedia --volume /Volumes/Yosemite --applicationpath /Applications/Install\ OS\ X\ Yosemite.app 
[If on Mavericks]: sudo /Applications/Install\ OS\ X\ Yosemite.app/Contents/Resources/createinstallmedia --volume /Volumes/Yosemite --applicationpath /Applications/Install\ OS\ X\ Yosemite.app -- nointeraction