Two ways to merge PDF files on Mac (GUI and command line)

This post introduces how to merge PDF files on Mac from GUI and from Terminal on Mac OS.

(For Ubuntu and Windows users, check out my post here for solutions.)

Method 1: GUI — using Preview  that comes with your Mac OS.

Check here for how to combine PDFs and reorder, rotate, and delete pages. If the page is not accessible, check the pdf I linked to in the references.

Method 2: From Terminal

We will introduce using gs command.

many people may already have gs package  installed and are already using gs.

TO check whether your Mac has gs installed,  in your terminal, issue the following command:

$ which gs

If you see something like this “/usr/local/bin/gs”, you OS has gs installed

If you see something like “… command not found”, you will need to install gs first.

You can use brew to install it.

$ brew install gs

If you do not have brew installed, check: Install Homebrew.

After you have gs installed,

in your terminal, cd to the directory where the pdf files you want to merge are located, and then issue the following command:

$ gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=merged.pdf source1.pdf source2.pdf source3.pdf

Then you will see a merged.pdf appear in the same folder where you source pdfs are.

Note: You may encounter these two errors in your terminal after your issue the pdf merge command I mentioned above, but be assured, the merge.pdf is correct. you can double check if you are worried about that:)

 

References:

Use Preview to combine PDFs on your Mac (pdf)

How can I combine multiple PDFs using the command line?

 

Leave a Reply

Your email address will not be published. Required fields are marked *