I would like to symlink my emacs init.el into a dotfiles repo - located at ~/Documents/Dotfiles. However, when I attempt to do so the command fails even though my prompt doesn't return an error - ls -la doesn't show a link there. For example, I might do the following:

ln -s ~/.emacs.d/init.el ~/Documents/Dotfiles/.emacs.d/init.el

Are emacs configs - due to their being, "under the covers", a directory - different in some way than other files you might want to symlink?


Tl;dr Aliases are weird and although the commands work, this link doesn't show in ls -la which is not really emacs' fault.


  • Clarify "the command fails". – Kusalananda Jan 6 '17 at 15:44
  • Trying this again, I get a "File exists" response - might be going in the wrong direction. See the screenshot above. – Chris Jan 6 '17 at 15:56
  • 1
    What shows ls -la /Users/Chris/Documents/Dotfiles/.emacs.d/init.el? If present delete the file and execute the command in verbose mode: ln -sv ... – marc Jan 6 '17 at 15:59
  • It looks like you have created the file ~/Documents/Dotfiles/.emacs.d/init.elalready. In that case ln will fail because the file already exists. Remove the file ~/Documents/Dotfiles/.emacs.d/init.el and then create the symlink. – Thomas Jan 6 '17 at 16:02
  • @mmmint ln: /Users/Chris/Documents/Dotfiles/.emacs.d/init.el: No such file or directory – Chris Jan 6 '17 at 16:31

As far as I can see, in my case this happens when the target link has directories which doesnt exist. Try this:

File should exist:

file /Users/Chris/.emacs.d/init.el

Remove previous symbolic link if present:

rm /Users/Chris/Documents/Dotfiles/.emacs.d/init.el

Now create needed directories:

mkdir -p /Users/Chris/Documents/Dotfiles/.emacs.d/

And create symolic link:

ln -s /Users/Chris/.emacs.d/init.el /Users/Chris/Documents/Dotfiles/.emacs.d/init.el
| 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.