Texpad and macOS Sandboxing
This article concerns the
macOS
app.
Sandboxing is only relevant to Texpad macOS when purchased from the Mac App Store. If you've bought Texpad directly from this website, or are planning to buy it, you do not have to worry about the file access restrictions this article refers to.

What is App Sandboxing

Sandboxing is aimed at protecting your computer by restricting how apps access your data. Starting from version 10.7 (Lion) macOS has the ability to sandbox applications. In this restrictive security model,

  • apps may not access files for which explicit access permissions have not been granted by the user.
  • apps may not launch external tools.

Technical details of sandboxing as implemented in macOS are given at these Apple pages. Here we will consider the implications for Texpad and what users will have to do to work in a sandboxed Texpad, as is the case from version 1.8.12 when purchased from the App Store.

Please note,

  • the version of Texpad purchased directly from our website is not currently sandboxed.
  • the sandboxing restrictions apply to Texpad purchased from the App Store.

Typesetting under App Sandboxing

Traditional process of typesetting TeX/LaTeX documents relies on calling upon tools such as pdflatex or xelatex for compiling your .tex source files into PDFs. These tools are installed outside of Texpad and hence fall foul to the sandboxing rules that prevent apps from calling them. This was one of the principle motivations for developing TexpadTeX that allows Texpad to compile .tex source without relying on external tools.

TexpadTeX Typesetter

All versions of Texpad on all platforms come with a built-in, integrated typesetter called TexpadTeX. In addition to being sandboxing-safe, TexpadTeX has further key advantages

  • Live output rendering: It typesets your documents as you write.
  • Live reporting of errors: It reports errors in the document as they occur, making it easier to track & fix them.
  • Lightweight & lean: It comes with basic set of LaTeX packages (collections of which are termed bundles) and you can add more packages only as you need.
  • No external installation: Texpad itself manages how packages are upgraded without the manual need for installing new LaTeX distribution.
macos/live-typeset-recording-hello-world.gif

As it is developed for the sole purpose of being the typesetting engine of Texpad, it is well-integrated into all aspects of the app’s workflow.

External Typesetters

Due to the vast nature of TeX, it is not possible to support certain tools and packages used in some documents. In few cases, where TexpadTeX does not support a package, tool or feature that your require, you may use our free cloud typesetter, which is fully integrated in the app.

macos/cloud-typeset-config.png

For the unsandboxed version of Texpad downloaded from texpad.com, you can install the full MacTeX/TeXLive distribution as before.

Availability Matrix

Version of Texpad macOS Internal Typesetter External Typesetter
Purchased from texpad.com TexpadTeX User-installed TeX distribution such as MacTeX/TeXLive
Purchased from Apple’s App Store TexpadTeX Our free cloud typeset servers with full TeXLive

Managing File Accessibility

Under sandboxing conditions, documents on your computer are treated in two different classes: those residing inside the sandbox of the app, and those outside of it.

Documents inside Texpad’s Sandbox

Like most non-macOS apps on sandboxed computers, Texpad is allowed full, unrestricted access only to its own ‘sandbox’, located at

~/Library/Containers/com.vallettaventures.Texpad/Data/Documents

Keeping files in a folder such as this may be highly unusual for most users who may feel great unease over storing their important documents in Texpad’s sandboxed Documents folder.

Files outside Texpad’s Sandbox – Granting Permissions

All files residing outside of Texpad’s sandbox folder on a computer must be granted explicit permission by the user before they can be accessed by Texpad. This permission can be granted in a number of explicit or implicit ways, such as

  • Opening a file in Texpad using the menu option File -> Open or key shortcut Cmd- O automatically grants Texpad permission to read and write to it.
  • Dragging a file to Texpad’s icon in the macOS Dock also grants Texpad full permission to it.
  • Double-clicking on a file in Finder (when Texpad is set to open files of that kind) comes with permission that the app opening the file may edit it.

These routes however only grant permission for a single file that is being specifically opened in Texpad. They do not provide permission to write the output PDF next to a .tex file (as is the norm when typesetting a document), nor do they allow Texpad and its typesetting process to load and use any other files that your LaTeX file may refer to. This particularly affects projects with multiple files, i.e., where a root file includes another file using \include{} command or projects that include images, using commands such as \includegraphics{}.

We understand that as a user, saving files in Texpad’s sandbox folder is a highly impractical solution in the long run. We have therefore introduced a new section called File Accessibility in Texpad’s Organiser window to manage file access permissions. This section helps you manage the list of files and folders that Texpad has been granted permission to access.

macos/ssb-management-view.png

The and buttons allow you to add and remove items from this list.

macos/ssb-open-dialogue-grant-access.png

You may also drag a folder or a file onto the File Accessibility table to give Texpad permission to do access.

Please note that where possible, you should allow access to folders instead of individual files as without access to the parent folder of a file, Texpad will neither be able to write the typeset PDFs, nor will be able to access any subfiles or images you may include in your files.

During the regular workflow of working on a LaTeX project in Texpad, various files are determined by Texpad to be part of the project. If these files are missing explicit permissions, Texpad will detect that and present the following dialogue that such permission ought to be granted,

macos/ssb-file-access-solicitation.png

You can choose to suppress these warnings if you so wish. These warnings will always be present in the usual typeset issues table in the sidebar,

macos/ssb-missing-file-access-warning.png

You can press the Fix button next to warning to grant the appropriate file access permission, which will lead to a successful typeset.