Sandboxing and Authorized Directories

Sandboxing is a macOS technology intended to provide extra security. To enforce these enhanced security measures, Apple has ruled that all applications sold via the Mac App Store must be sandboxed. Sandboxing provides this extra security by limiting the tasks that applications are allowed to perform. One such limitation is that applications can only access files and folders to which the user has granted access using an Open or Save panel.

This means that Scrivener is unable to open or access arbitrary files on your system without you telling it to. For the most part, this is fine - when you open a Scrivener project, most of the files it needs are contained within that project file and, by opening the project, you have given Scrivener permission to operate on those files, meaning that you can edit, save and work as usual. However, there are certain types of files that, under sandboxing, Scrivener will not be able to access so easily:

- Bookmarks: Scrivener's inspector can store a list of bookmarks to external files. Because these files are stored outside the project, Scrivener may not be able to open them by default.
- Alias files: It is possible to import research files as aliases using File > Import > Research Files as Aliases... Under sandboxing, Scrivener may not be able to open such files, and when you try to open them in the editor you will see a message telling you that the file cannot be opened.
- Linked images in text: When inserting an image into text, rather than inserting a copy of the image, it is possible to insert it as a link to the original file on disk using Insert > Image Linked to File... If the original images are stored in locations to which sandboxing does not grant Scrivener access by default, these images may not appear correctly in the text, a placeholder image being displayed instead.

## How to Grant Scrivener Access to More Files

Fortunately, there's an easy way to grant Scrivener permission to various locations on your computer so that Scrivener can still use all of these files. Here's how:

1. Go to the "Scrivener" menu and select "Authorize Folder Access...". This will open the following panel:

2. To grant Scrivener permission to access external files, simply click on the "Add Folders..." button. This will bring up an Open panel from which you can select the folders you wish Scrivener to have access to. Alternatively, you can just drag files into the "Accessible Folders" list from the Finder.
3. To stop Scrivener accessing files, select the folders in the list that you no longer wish Scrivener to have access to and click on "Remove Access".

## Tips

When you grant Scrivener permission to access a folder, it will be able to access all of the files inside subfolders of that folder too. Thus, you only need to select the highest level folders with which you feel comfortable for Scrivener to have access.

The main thing to consider when adding folders to the list is which files you need Scrivener to access. For instance:

- If you tend to import many different files into Scrivener as aliases (using File > Import > Research Files as Aliases...), or if you make heavy use of Scrivener's "Bookmarks" feature to refer to external files, then you may wish to consider adding your entire home folder to the list of accessible folder. This will give Scrivener access to all folders inside your home folder without you having to add each one separately, such as your Pictures, Movies and Documents folders. The downside of this approach is that it somewhat defeats the point of sandboxing, which is to ensure that, should any malicious software take control of your other programs, it is limited in what it can access. Thus, although adding your entire home folder is the easiest approach, it is also the least safe in the event that your computer is exposed to malware.
- If you are very careful about where you store all the files on your hard drive, and you only tend to add images to Scrivener as linked files and import a few sound and movie files as aliases, you might only need to add the ~/Pictures, ~/Movies and ~/Music folders to the list.
- Perhaps the safest and easiest approach would simply be to have a folder somewhere on your hard drive for storing your research documents, and only grant Scrivener access to that.

Essentially, though, for any files you want to be able to view in Scrivener that are not stored inside the Scrivener project, you must grant access to one of the folders containing that file. For instance, suppose you have added the file ~/Documents/Ideas/Writing/MyGreatIdea.pdf as a reference in one of your projects. For Scrivener to be able to open that file, you must grant access to one of the following folders:

- ~/Documents/Ideas/Writing - in which case Scrivener will be able to access all files inside the "Writing" folder.
- ~/Documents/Ideas - in which case Scrivener will be able to access all files in the "Ideas" folder, as well as any folders contained in the "Ideas" folder and any files or folders inside those.
- ~/Documents - in which case Scrivener will be able to access all files, folders, subfolders and sub-files within the "Documents" folder.
- ~/ - in which case Scrivener will have full access to your home folder. (Adding this is the easiest option if you do not want to have to worry about authorising the right folders every time you add a new file, but it is also the least secure.)

## Granting Access to Hidden Folders

Some folders are hidden in the Finder, making it difficult to grant Scrivener access to them. For instance, for KindleGen to work correctly when compiling to the Kindle .mobi format, it requires access to the hidden /private/tmp folder. In the case of Kindle export, Scrivener will walk you through authorising the /private/tmp folder when you go to compile to that format. However, you could equally add it using the Finder's "Go to Folder..." feature, like so:

1. In the Finder, open the "Go" menu and select "Go to Folder...".
2. In the text field that appears, type, "/private" and click on "Go". This will open the contents of the /private folder in a regular Finder window.
3. In Scrivener go to the "Scrivener" menu and select "Authorize Folder Access..."
4. Bring up the Finder and, from the Finder window displaying the contents of the /private folder, drag the "tmp" folder and drop it into the "Accessible Folders" list in the "Authorize Folder Access" window in Scrivener.