Create OS X NetInstall Images from Command Line
Creating NetInstall images on OS X is quite easy, there are a number of different ways to do so. There are tools such as AutoNBI, or Casper NetInstall Creator. But third party tools are not required to make the NBI for Mavericks, Yosemite, or El Capitan. The System Image Utility is a great tool with a GUI to make the images. The only caveat to this that I have found is that you can only create an image from the installer of that version you are on. So lets say you have a MacBook Pro running Yosemite and you have the Install application for Mavericks in your applications folder. When opening the System Image Utility, it would not recognize the installer.
One way to go around this is to use the imagetool through the command line. This is a Unix Executable File located in the Contents folder of the System Image Utility.
/System/Library/CoreServices/Applications/System Image Utility.app/Contents/MacOS/imagetool
From Terminal, this can be run to create a NetInstall Image with the install application that was downloaded from the App Store and no other tools are required. To create a Mavericks NetInstall, I have copied the Install OS X Mavericks.app outside of the Applications folder for safe keeping, but in order to run the tool the installer must be in the Applications folder. Open up terminal and run this command (note, you must be sudo to run):
sudo /System/Library/CoreServices/Applications/System Image Utility.app/Contents/MacOS/imagetool --netinstall --index 1001 --source /Applications/Install OS X Mavericks.app --destination /Mavericks/NetInstall of Mavericks OS X --name Mavericks NetInstall
The same can be done with Yosemite on the same MacBook Pro mentioned earlier.
sudo /System/Library/CoreServices/Applications/System Image Utility.app/Contents/MacOS/imagetool --netinstall --index 1002 --source /Applications/Install OS X Yosemite.app --destination /Yosemite/NetInstall of Yosemite OS X --name Yosemite NetInstall
In order to create the NetInstall image for El Capitan, the machine MUST be running El Capitan. Otherwise, image tool will throw an error and will not complete. However, on an El Capitan machine the command is the same and you can create all three versions from there.
sudo /System/Library/CoreServices/Applications/System Image Utility.app/Contents/MacOS/imagetool --netinstall --index 1003 --source /Applications/Install OS X El Capitan.app --destination /El Capitan/NetInstall of El Capitan OS X --name El Capitan NetInstall
The only version of OS X where the imagetool command is different is in Mavericks, where the executable is located:
/System/Library/CoreServices/System Image Utility.app/Contents/MacOS/imagetool
alternative link download