Fix nonfunctional Mail PDF function in OS X Preview

Apple's Preview PDF reader has an option to generate a new Mail message containing the current PDF document, but in some cases this feature may not work.

Apple's Preview application is the default PDF reader, and has a number of features that make it a convenient program to use. For example, you can quickly e-mail the PDF document you're reading by choosing the "Mail Selected PDF Document" option in the File menu.

This option should work for other document types as well, but some people have been finding this feature is not working at all. When the option to mail PDFs is selected, the system just sits there without opening Mail or generating any new messages containing the PDF document.

Preview File menu
The option to e-mail PDF documents is available in Preview's File menu. Screenshot by Topher Kessler

If this happens to you, the problem at hand likely arises from a fault in the way Preview is interacting with the sandboxing features that Apple has implemented in OS X.

Sandboxing is a method of restricting a program's access to system resources without direct user consent. When a program is run, specific access rules called "entitlements" are applied to it that allow it to read from or write to only specific resources such as the user's home folder. This feature allows a program to, for instance, write a preferences file to your Library folder but keep it from modifying some core system files or folders unless you specifically authenticate and instruct it to do so.

When sandboxed applications run, they do so in a restricted environment called a container, which is a summation of the entitlement rules for that program, and which can be seen for some programs that have special file handling services (such as Preview) by going to the /username/Library/Containers/ directory.

If an application's container is corrupted or otherwise improperly configured, then conflicts can occur that prevent it from accessing files it needs, or from performing tasks like transferring files to and from other programs and services on the system.

Sandbox container configurations in the Finder
The configuration for Preview's sandbox container is stored in each user's Library folder. Screenshot by Topher Kessler

In the case of Preview not being able to mail PDF documents, it may be that the sandboxing rules for Preview's container are conflicting with the global rules in the system, especially if you upgraded your OS instead of installing it freshly.

The easiest way to address this problem is to remove the container configuration that the system is using for Preview, and force the system to rebuild it from the native sandboxing entitlement rules that the system has for Preview. Preview's container is in the user library folder, which in Snow Leopard can be directly accessed from your home directory, but if you are using Lion you will need to hold the Option key and then select the Library from the Finder's Go menu.

When you are in the library, go to the Containers directory, and then remove the folder called "com.apple.Preview," which holds a configuration property list along with a directory tree of linked resources the program has accessed. Removing the entire com.apple.Preview directory and then relaunching Preview will spur the system to create a new container for the program, which should be built off of working rules. After this, the Mail PDF document function should work as expected.



Questions? Comments? Have a fix? Post them below or e-mail us!
Be sure to check us out on Twitter and the CNET Mac forums.

Tags:
Computers
About the author

    Topher, an avid Mac user for the past 15 years, has been a contributing author to MacFixIt since the spring of 2008. One of his passions is troubleshooting Mac problems and making the best use of Macs and Apple hardware at home and in the workplace.

     

    Join the discussion

    Conversation powered by Livefyre

    Don't Miss
    Hot Products
    Trending on CNET

    HOT ON CNET

    Looking for an affordable tablet?

    CNET rounds up high-quality tablets that won't break your wallet.