For Mac OS X 10.9.2 and later, make sure that Homebrew is installed, and use brew install [pkg]. To install a specific version of the [pkg], use brew install [pkg] --version[version]

For Ubuntu/Debian use sudo apt-get install [pkg]

For Red Hat/Fedora/CentOS use sudo yum install [pkg]