What is the best way to generate a Yosemite or Mavericks Install USB flash drive? I could probably copy the contents from the package, but what is the best way to create an install Flash Drive for Mavericks?

Of course ideally the drive should be bootable.
Edit: this also should work for El Capitan with a 6.33GB+ partition



Currently the best way seems to be through createinstallmedia, which is also Apple's recommended method.

First create a Mac OS Extended (Journaled) partition on the USB key with 5GB or more:



then in the terminal use the createinstallmedia command. It can be found in the Maverick install apk. By default the path is /Applications/Install OS X Mavericks.app/Contents/Resources/createinstallmedia.

Replace /Volumes/MavericksInstall with your own partition name:

sudo /Applications/Install\ OS\ X\ Mavericks.app/Contents/Resources/createinstallmedia --volume /Volumes/MavericksInstall --applicationpath /Applications/Install\ OS\ X\ Mavericks.app --nointeraction


The output should be along these lines:

Copying installer files to disk...
Copy complete.
Making disk bootable...
Copying boot files...
Copy complete.
Done.


The setup should take few to few dozens minutes depending on your USB drive.



To create a USB installer for multiple OS X versions you can to go through the following procedure:


Start disk utility
Create multiple partitions formatted as Mac OS Extended (Journaled). Give them names like:


OS X Lion : LionInstall
OS X Mountain Lion : MountainLionInstall
OS X Mavericks : MavericksInstall






Generate multiple install partitions using the createinstallmedia tool of each OX 10.9+ version and add the other install partitions using disktool : 


restore the InstallESD.dmg from /Applications/Install Mac OS X Lion/Contents/SharedSupport  to /Volumes/LionInstall
restore the InstallESD.dmg from /Applications/Install OS X Mountain Lion/Contents/SharedSupport  to /Volumes/MountainLionInstall
sudo /Applications/Install\ OS\ X\ Mavericks.app/Contents/Resources/createinstallmedia --volume /Volumes/MavericksInstall --applicationpath /Applications/Install\ OS\ X\ Mavericks.app --nointeraction





From experience here is the data usage for each OS X version :


OSX 10.6 Snow Leopard: 7.19GB
OSX 10.7 Lion: 4.78GB (requires 6.13 GB)
OSX 10.8 Mountain Lion: 4.48GB
OSX 10.9 Mavericks: 5.4GB
OSX 10.10 Yosemite: 5.25GB
OSX 10.11 El Capitan: 6.33GB
macOS Sierra: 4.84GB