Since Mac Os 10.9 (Mavericks) , Mac os installers support createinstall command to easily (ish) create bootable usb media version of corresponding mac os installation file.
Corresponding article from Apple can be found here - https://support.apple.com/en-au/HT201372
Despite following above apple article I could not make it work, I eventually figured out that you need to specificy installer location if i'ts not in usual location being Application folder.
So two points
1. Use sudo
2. you need to specify both volume being converted to usb bootable installer AND path of the installer
Usage: createinstallmedia --volume <path to volume to convert> --applicationpath <path to Install OS X Mavericks.app> [--force]
*You can drag and drop the file/volume directly
Arguments--volume, A path to a volume that can be unmounted and erased to create the install media.
--applicationpath, A path to copy of the OS installer application to create the bootable media from.
--nointeraction, Erase the disk pointed to by volume without prompting for confirmation.
Example: createinstallmedia --volume /Volumes/Untitled --applicationpath /Applications/Install OS X Mavericks.app