How to compress a PDF file on MacOSX (& Linux)

Often (and especially when scanning documents with my printer) from MacOSX I would get unreasonable huge PDFs which are not suitable for emails.

To strip them down without pain one can use ghostprint:

gs -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -sOutputFile=output.pdf input.pdf

To get gs installed, one can just brew it: brew install gs