29

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 Answers 4

55

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!

8
  • 1
    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
    Commented Oct 8, 2019 at 19:10
  • 1
    This worked for me.
    – firesofmay
    Commented Jan 2, 2020 at 11:14
  • Changing Full Disk Access on /usr/bin/ruby worked for me. Thanks for the tips on seeing hidden folders. Commented Sep 14, 2020 at 20:38
  • The /usr/bin/ruby worked for me too! Thanks!
    – egilchri
    Commented Mar 17, 2021 at 0:59
  • Thanks a lot, I was facing this issue since long time. Adding /usr/bin/ruby worked for me
    – nerding_it
    Commented Nov 17, 2021 at 8:25
5

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.

5
  • 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
    Commented Oct 8, 2019 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
    Commented Oct 8, 2019 at 10:40
  • 1
    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
    Commented Oct 8, 2019 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
    Commented Oct 9, 2019 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
    Commented Oct 9, 2019 at 20:12
3

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

1

The file system permission issue is only one of the issues which are occuring due to the indirect execution of the Emacs binary via a ruby script. The best solution I found was to simply replace the startup script with the right binary for Catalina as described in https://spin.atomicobject.com/2019/12/12/fixing-emacs-macos-catalina/. Basically all you have to do is

cd /Applications/Emacs.app/Contents/MacOS
mv Emacs-x86_64-10_14 Emacs
rm -rf ../_CodeSignature

Besides fixing the file system issue this ensures that the Emacs window will be properly brought to front when switched to via spotlight and also ensures that only one Emacs instance gets started if you open an associated file via Finder.

You must log in to answer this question.

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