Compress PDF on OS X in Terminal

For my own reference, GhostScript is a great tool to compress those huge PDF files that your scanner generates.

In order to use GhostScript PDF compressor, you need to install GhostScript first:

brew install ghostscript

Then you can run the following command to compress your original file to a smaller file

gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4  -dPDFSETTINGS=/ebook -dNOPAUSE -dQUIET -dBATCH -sOutputFile=/Users/marko/Desktop/small.pdf /Users/marko/Desktop/original.pdf