I updated to macOS Catalina which requires the user through pop-ups to allow any app trying to access the file system for the first time.

No such pop-up is appearing for Emacs. Running the script shared here, https://gist.github.com/dive/f64c645a9086afce8e5dd2590071dbf9
does not seem to change anything. That is, Emacs and any shell running in it cannot access any file on the file system.

How can I restore the access?

My Emacs version is *GNU Emacs 26.1 (build 1, x86_64-apple-darwin14.5.0, NS appkit-1348.17 Version 10.10.5 (Build 14F2511))

Granting the Emacs app Full Disk Access in "General Settings -> Security & Privacy -> Privacy" does not solve the problem.

  • 1
    Go to "General Settings -> Security & Privacy -> Accessibility" and add there Emacs, to allow it to control your computer. Then trying to open a file from Emacs will open a short dialog asking to confirm permission for that folder. The allowed folders will appear in Privacy -> File and Folders. Maybe it will be useful to upgrade to Emacs 26.3
    – Ian
    Oct 8 '19 at 14:36
  • Thanks, Emacs was already allowed under Accessibility. I removed and re-added it. I also re-installed and thus upgraded to Emacs 26.3 in the meanwhile. All to no avail!
    – wsaleem
    Oct 8 '19 at 14:45
  • 1
    Is this other post dealing with the same or a different problem? I tried the selected solution of this problem—adding disk access to both Emacs and ruby—for *that solution and it didn't work, and I'm not sure if that's because the answer here isn't correct or because it's a different problem.
    – HaPsantran
    Nov 25 '19 at 16:11
  • The solution here solved the problem in this thread for me. I don't know about the other problem.
    – wsaleem
    Nov 25 '19 at 16:28
  • The accepted answer doesn't work, as noted. I got it to work by reading this thread on github I ran the script suggested in the thread, but it didn't help, but then I did M-x ns-open-file-using-panel and opened ~/Download opened a file. And then it worked. So now it works fine for me at least. But I had to re-do it for ~/Documents etc.
    – larsr
    Jan 19 '20 at 20:30

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. Open General Settings -> Security & Privacy -> Privacy, select Full Disk Access in the left pane, then click + and add /usr/bin/ruby to resolve your issue.

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

  • 4
    @Chris's answer is right, or you can launch emacs in the terminal, which also resolves your problem. Oct 9 '19 at 2:53
  • 3
    Thank you! Worked great. I had to go back to "Security & Privacy" and click on General (after granting ruby access and trying emacs). And found that I had to "Allow apps downloaded from - App Store and identified developers. I ended up doing this twice. Looks like emacs is using some legacy stuff and that os x is checking more things that are not theirs. BUT worked great after that, so full access to ruby and then the legacy stuff and it worked. Outstanding post, thank you! Oct 9 '19 at 11:59
  • 6
    Is there a way to allow only a specific folder using "Files and Folders" instead of "Full Disk Access"?
    – Bee
    Nov 15 '19 at 16:22
  • 7
    I'm not sure it is so secure to give full access to any ruby script....
    – larsr
    Jan 19 '20 at 20:28
  • 1
    If you run emacs in the terminal, you need to give access to the Terminal app or whichever terminal app you use.
    – nroose
    Mar 27 '20 at 4:25

@Chris's answer also resolves a different problem for me (which had the same root cause): I'm recording it here to make this answer more findable.

I was getting the error "Listing directory failed but 'access-file' worked" on ~/Downloads (and Documents, Desktop, and some others). I tried adding Emacs to System Preferences > Security & Privacy > Full Disk Access, without success, as mentioned above. But adding /usr/bin/ruby solved it.

  • 2
    I used this to resolve the problem (also upvoted, b/c it solves the problem). HOWEVER, I feel like this is a security hole. I don't want ruby to have access to my entire computer. I'd just like Emacs to have access to my user directory, but that doesn't seem possible. I tried, but perhaps I don't know enough to know how to do it. Feb 15 '21 at 23:21

To get the full functionality of emacs back, I had to follow this document: https://spin.atomicobject.com/2019/12/12/fixing-emacs-macos-catalina/

All the other solutions did not fix the problem of clicking on a txt file with open emacs and opening the file within the open emacs.

Edit: As of May 2020 this seems to have stopped working. But here is a working solution: https://emacs.stackexchange.com/a/54383/2440

  • 1
    Same. Just take care to mv the right binary. I had to mv the lower-numbered *_10 binary instead of *_14 to get things to work, as in the link, even on Catalina. Dunno why
    – Paul
    Sep 2 '20 at 1:11

Not the answer you're looking for? Browse other questions tagged or ask your own question.