5

I upgraded to macOS Catalina and see that applications now need to be permitted to access the file system, even the shell running inside Terminal.

I work extensively in Emacs which seems to have lost access to the file system. Unlike with other applications, no popup appears to allow the access for Emacs.

How can I restore file system access for Emacs?

4

I solved the problem by granting Full Disk Access to /usr/bin/ruby as suggested here. Quoting from the reply,

Emacs.app actually launches using a ruby script. As a result, MacOS Catalina uses the permissions set for ruby, not the permissions for Emacs.app.

Grant access as follows.

  • Go to "System Preferences -> Security & Privacy -> Privacy"
  • Select Full Disk Access from the left menu. It is about half way down in the menu. A list of apps will appear in the main region of the window.
  • Click the lock on the lower left and authenticate in order to allow making changes.
  • Click the + button under the list of software and select /usr/bin/ruby.
    • /usr is usually a hidden folder and may not appear by default. If so, press shift+cmd+. (the last one is a dot) at the root directory to make it appear.

Emacs.app should now be able to access the file system without any hindrance!

  • This is because you’re using the special version of Emacs where the icon really is not Emacs, but a ruby script that launches one of multiple Emacs programs that comes in a package. The Emacs program that comes with macOS is not like that. – jksoegaard Oct 8 at 19:10
1

This is caused by the Privacy features introduced with macOS Mojava and expanded with macOS Catalina. Essentially apps are sandboxed and not allowed to access the full disk, unless you give them that permission.

You can give an application access to the full disk like this:

  • Open System Preferences
  • Click Privacy & Security
  • Choose the Privacy tab
  • Select Full Disk Access in the lift on the left
  • Click the lock in the bottom left corner to unlock
  • Drag the application into the list on the right

The next time you launch the application, it will have access to the full disk.

The standard emacs supplied with the system is run through Terminal.app. If you're using emacs like this (with the system supplied or for example an installation from HomeBrew or MacPorts), you need to drag Terminal.app on to the list to give access.

If you're using a third party GUI-based Emacs, you'll need to drag the .app for that program on to the list.

Note that some Emacs "distributions" package together a number of Emacs binaries for various macOS versions in a single folder, and dynamically at runtime chooses the right one for your system. This means that the icon you click to start the program is really a "placeholder" that is not Emacs itself, but rather just starts up Emacs. This "placeholder" often takes the form of a Ruby script. If this is the case, you'll need to drag the Ruby program on to the list.

Ruby comes with macOS by default. You can find the program by opening Finder, and then from the "Go" menu choose "Go to Folder". Enter "/usr/bin" and you'll get that folder opened in Finder. In the folder, you'll find the ruby program that you can drag on to the Full Disk Access list.

  • Thanks, this is the first thing I did. It does not provide access to Emacs launched from the icon. However, if I launch Emacs from the package contents, it launches through Terminal and has access. This may be due to the fact that I granted access to Terminal earlier. I would like to have access through the icon. – wsaleem Oct 8 at 10:34
  • You failed to mention that you have a non-default installation of Emacs. In this case, drag the Emacs icon into the list instead of Terminal.app. – jksoegaard Oct 8 at 10:40
  • My Emacs is from emacsformacosx.com which claims to be "Pure Emacs". Granting Emacs "Full Disk Access" does not seem to be solving the problem. – wsaleem Oct 8 at 12:42
  • You completed changed your reply in the edit. I am not on meta but this is probably not good practice. Responding to your new, edited reply, yes, I did not share that I am not using the default emacs. That is outdated and I believe it is standard practice to install a newer one separately. Catalina seems to have dropped the default emacs. – wsaleem Oct 9 at 18:38
  • @wsaleem Why would that not be good practice? - You changed the question from being about "emacs" (which would easily be understood as the one that comes with the system) to being about a specific "emacsformacosx.com emacs". I then updated the answer to account for both. The actual answer is the same before and after the edit (i.e. this is how to enable Full Disk Access), but I added the explanation that now that you specified that you're using a specific emacs distribution, now it is a different program that should be given FDA. – jksoegaard Oct 9 at 20:12
0

Emacs.app actually launches using a ruby script. As a result, MacOS Catalina uses the permissions set for ruby, not the permissions for Emacs.app. Granting /usr/bin/ruby full disk access in "General Settings -> Security & Privacy -> Privacy" should resolve your issue.

/usr is hidden by default on MacOS but you can toggle visibility in the Finder by using Shift+Command+Period

New contributor
gokul is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .