How to install pkg file commandline?

Recently, when I tried to install a pkg file, just by double clicking, it gave an error. In such situations commandline installer tool comes handy. Here is how you can use it.

sudo installer -pkg <pkg name> -target /

(Usually the target location is the root folder. However you can also point it to some other location depending on your requirements)
Here is an example.

sudo installer -pkg ~/Downloads/iStockphotoApertureExport.pkg -target /
Be Sociable, Share!
Categories: Software, Tips & Tricks, Unix