PDFs are widely used format for documents that you have probably been using for years while exchanging documents with your colleagues. The great thing about PDFs is that they can be created in almost all the word processors and the only tool that you need to open these PDFs is the Adobe Reader, or any other PDF reader, for that matter.

While creating PDFS, you may have come across multiple files that you wished if you could merge them into a single PDF. By merging multiple PDFs into a single PDF file, you can save yourself from the hassle of opening each PDF in a PDF reader to access its content as you can just open that single PDF and read everything you want.


Merging PDF files on a Mac can be done using various ways, and the most efficient and fastest way to do that is to use the right-click menu. Using an Automator script, you can add an option in your right-click menu that lets you merge two PDF files together.

In the following guide, you’ll learn how you can create an Automator script that adds an option in the right-click menu of your Mac to merge two PDFs together.

Here you go:

Merging PDF Files Using the Right-Click Menu on a Mac

To do these steps, all you’re going to need is the built-in Automator app on your Mac and the PDF files that you want to merge.

Before you can create the script in Automator, you’ll need to install a Python module which can be done using the following section:

Installing the Python Module Using Terminal

1. Launch Terminal on your Mac by clicking on Launchpad in the Dock and searching for and clicking on Terminal. The app will launch.


2. When Terminal launches, type in the following command and press Enter. It will install the Python module on your Mac.

sudo easy_install PyPDF2


3. You will be prompted to enter your admin password to move forward. Do so and press Enter.


4. You should see something like the following on your screen when the module is installed.


5. Exit out of the Terminal app as you no longer need it to do this procedure.


Now that you have the required Python module installed on your Mac, you can go ahead and do the following steps on your Mac to add an option for merging PDF files on your machine.

Creating an Automator Script for Merging PDF Files with Context Menu

1. Launch Automator on your Mac by clicking on Launchpad in the Dock and searching for and clicking on Automator. The app will launch.


2. When the app launches, click on the File menu at the top and select the option that says New to create a new file in the app.


3. On the following screen, select Service as the document type and then click on Choose to begin creating your script with Automator.


4. You will see a couple of drop-down menus on the top of the workflow. Select files or folders from the Service receives selected drop-down menu and select from the in drop-down menu.

Your screen should look like the following:


5. Drag the action named Get Selected Finder Items from the actions panel on the left over to the workflow on the right.


6. Drag the action named Run Shell Script from the actions panel on the left over to the workflow on the right.


7. In the Run Shell Scrip section in your workflow, select the following:

Shell – /usr/bin/python

Pass input – as arguments

Then, copy and paste the following script into the script box on your screen.

#!/usr/bin/env python
# Jacob Salmela
# Make PyPDF2 is installed: sudo easy_install PyPDF2
import sys
import os
from PyPDF2 import PdfFileMerger, PdfFileReader

merger = PdfFileMerger()

# Get the folder of the first file and that's where the merged PDF will go
dirname = os.path.dirname(sys.argv[1])

for f in sys.argv[1:]:
filename = os.path.basename(f)
print("Appending " + filename + "...")

# Append each page to the merger
merger.append(PdfFileReader(file(f, 'rb')))

# Close the file to prevent duplicate pages from being appended

# Write all the appends to a new file
merger.write(dirname + "/merged.pdf")


8. Click on the File menu at the top and select Save to save the service.


9. Enter a name for the service on the following screen and click on Save to save it.


10. Here begins the actual task of merging PDF files. Now, find two PDF files that you wish to merge and select them both and right-click on them and select Services followed by Merge PDF Files. You will get a new PDF file called merged.pdf that will have both of your combined files in one.


You’re all set.

So, that was how you could easily merge PDF files on a Mac without using a third-party application. All it requires is a right-click on the files, and the files are then merged.

Let us know if this helped you!

Enter your email address:

Delivered by Alphabet