No matter where I am or how I open emacs, I get this message:

File exists: /home/{user}/.emacs.d/

I then have to C-x C-f to get to the file I was trying to edit. What is going on here, and how do I fix it?

enter image description here

  • What does ls -la ~/.emacs.d say? – cjm Dec 9 '13 at 21:12
  • drwx------ 2 root root 4096 Sep 23 10:54 auto-save-list – MirroredFate Dec 9 '13 at 22:48
  • That can't be the full output. ls -la on a directory should include the . and .. entries. – cjm Dec 9 '13 at 23:56
  • @cjm That is correct. I did not include the . or .. directories. – MirroredFate Dec 10 '13 at 1:45

You get this error if ~/.emacs.d exists but is not a directory readable by your user. From the partial output of ls -la ~/.emacs.d you gave, it appears that you somehow managed to get a .emacs.d directory in your user's home directory that's owned by root and has no permission for your user.

You could try (as root)

chown -R user:yourgroup /home/user/.emacs.d

where user is your username and yourgroup is your user's primary group.

| improve this answer | |
  • 1
    If that is the meaning of this error message then I would suggest that someone use M-x report-emacs-bug to ask for a more meaningful error message. As it stands, the message is not helpful and is in fact misleading. (Just one opinion.) – Drew Dec 10 '13 at 1:32
  • This changing the owner fixed it. Thanks so much. – MirroredFate Dec 10 '13 at 1:48

If you have a file called ~/.emacs.d and emacs where to attempt to look in a directory called ~/.emacs.d/ for a file names init.el, it would encounter an error such as this. If you have a file called ~/.emacs.d perhaps you could move it to init.el and put it in a directory names ~/.emacs.d

If not then there could be a line in your legacy emacs config file ~/.emacs that is attempting to create this directory.

| improve this answer | |
  • I have no file ~/.emacs.d, init.el, or /.~emacs. – MirroredFate Dec 9 '13 at 22:52

The cause may be running emacs as root ("sudo emacs ...") before running it as the logged-in user. I did this while setting up my system, and ran into the same problem. Emacs of course creates the .emacs.d directory if it does not exist, and if emacs is running as root, the directory will be created with root as owner.

The same applies to the .emacs file -- you might want to check the ownership of that, too.

Changing the owenership from root to the user fixes the problem, as has been noted.

| 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.