PDF-tools and OSX: how I made it work

The PDF-tools emacs package is amazing for extending the usefulness of emacs for everyday tasks. PDF-tools is a very fast pdf reader with all the text navigation features Emacs offers, plus the ability to interface with other packages such as interleave for note-taking. However, pdf-tools is notoriously difficult to get going on a mac. Here, I’ll try to document what I did to get it running on my system - a process that involved some stumbling but was ultimately successful.

1. Dependencies

I had to install a few dependencies via Homebrew before diving into emacs to install pdf-tools. Poppler is a tough one to figure out. Homebrew had a tough time “linking” it due to insufficient permissions for the /man/man5 folder, so I had to sudo chown the file to fix up the owner and group. That done, I was able to attempt to install pdf-tools via emacs using the command m-x pdf-tools-install, though it would error out almost immediately.

2. Installation

I attempted to install pdf-tools via homebrew: brew install pdf-tools --HEAD. Installing with the option --HEAD installs the software from master on Github, rather than from the most recent build. I heard that the error I saw earlier was fixed in master, so that’s why I used that option. Unfortunately, it still didn’t work, so I went on and uninstalled it anyways.

What finally worked for me was installing from Melpa: M-x package-list-packages -> pdf-tools -> install. After this, I ran pdf-tools-install once and then added (pdf-tools-install) to my init. That’s it! I can open PDFs like any other text file, and they automatically pop up in a new Emacs buffer. Interleave mode works moderately well, and I’m satisfied with everything.

3. Basic usage

Here are a few things you can do with pdf-tools:

  • Highlight text: Select text with mouse and highlight with C-c C-a h
  • Add text: C-c C-a t
  • Strikethrough text: C-c C-a o
  • Delete annotation: C-c C-a D
  • Search text: C-s (need to add to init: (setq pdf-annot-activate-created-annotations t)


Hope this helps.

comments powered by Disqus