When I do C-x C-f on ~/Desktop/ in macos Catalina, I get the following error.

Listing directory failed but 'access-file' worked

I can list the directory for just ~.

I'm new to Emacs and know little else. I've tried installing Emacs through Homebrew and using a binary from https://emacsformacosx.com

I've also searched for that error where some people said there's an issue with ls on mac, but I don't have any problem listing the contents of ~. Also, I didn't find any clear solution to that problem (I tried copy pasting answers to my init file but that didn't solve anything).

  • 1
    Welcome to emacs.SE! Can you ls ~/Desktop from a terminal? – JeanPierre Nov 21 '19 at 12:53
  • i can ls ~/Desktop, but first a popup appeared asking for permission – Nabi Yang Nov 22 '19 at 14:31

I found it. Apparently dired can't access icloud directories. My Desktop and Documents folders are sync'ed with icloud.


If anyone comes here curious as to how they can access Desktop, Documents, or Downloads, the answer is in the link above, for reference, but I'll put it here in case that link expires.

  1. In System Preferences -> Security & Privacy, select the Privacy tab.
  2. From the list on the left, select Full Disk Access.
  3. Click the padlock in the lower left of the window to unlock this setting, if necessary.
  4. Click the + button to add Emacs to the list, then add Emacs.

Now in Emacs, do the following for each of the three directories: Desktop, Documents, and Downloads.

  1. Press Cmd+O to open a file.
  2. Open any arbitrary file in the folder you want access to.

From now on, you'll be able to use C-x C-f to open ~/Desktop/, for example.

| improve this answer | |
  • Can you get to them using a remote-file name? Can you get to it with Tramp, otherwise than using Dired? If so then try the same (remote-file name) with Dired. – Drew Nov 21 '19 at 15:16
  • Does it help if you customize the variable dired-use-ls-dired? Try setting to nil. – John Palmieri Nov 22 '19 at 4:45
  • i haven't any clue what the remote file name is for my Desktop. i don't know what Tramp is either. i may be able to look into it later. i used M-x set-variable and typed in nil for dired-use-ls-dired but still have the same problem – Nabi Yang Nov 22 '19 at 14:38
  • 1
    Have you tried giving ruby full disk access? See emacs.stackexchange.com/questions/53026/… – John Palmieri Nov 22 '19 at 21:14
  • i haven't tried giving ruby full access. my question was simply "why" i couldn't access my Desktop, which i found the answer to. i've marked it as the answer. now as to "how" i can access it, the answer is in the link in my answer. i've tried it just now and it works! – Nabi Yang Nov 23 '19 at 12:47

If you find the problem persists after granting Emacs full disk access: from here on the problem remains because Emacs on MacOS gets launched indirectly, from a Ruby script. Your Emacs binary has full disk access, but Ruby does not.

One way to get around this is to get the Ruby script out of the way, and replace it with a symlink to the correct binary for your platform. See


for an example.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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