1

I'm currently setting up my new system (OS X) and trying to link ~/Git/ to /Library/WebServer/Documents/, so that I can access all my git repositories via 127.0.0.1. However, that doesn't work as expected.

While I was able to symlink other directories:

ln -s / ~/Desktop/root
ln -s ~ ~/Desktop/home

it just doesn't want to work with my ~/Git directory:

sudo ln -s ~/Git /Library/WebServer/Documents/Git
ln -s ~/Git ~/Desktop/Git

The link is created, but it's telling me The operation can’t be completed because the original item for “Git” can’t be found. Wherever I place it, the behaviour is always the same. It also seems to be the same with other directories in my home directory (except for the home directory itself).

ls -l ~/Desktop
lrwxr-xr-x  1 user  staff   1 Jul  8 08:31 : -> /
lrwxr-xr-x  1 user  staff   4 Jul  9 12:50 Git -> /Users/user/Git
lrwxr-xr-x  1 user  staff  29 Jul  8 08:38 wwwroot -> /Library/WebServer/Documents/
lrwxr-xr-x  1 user  staff  19 Jul  8 08:31 ~ -> /Users/user
2

Normally (because the default shell on OSX is bash), tilde (~) is expanded to your home directory. That is documented in the Bash Reference Manual: Tilde Expansion.

However, your directory listing shows that you have created an entry "~" in your desktop, either by bypassing the default behavior (quoting, as mentioned in How to manually expand a special variable (ex: ~ tilde) in bash), or due to some error finding the actual home-directory. Since you say this is in any directory, it sounds as if (during the account creation), you have moved/renamed things, e.g., a different disk drive, so that bash finds no actual directory at the location where it should. So you get a literal "~".

| improve this answer | |
  • Uhm, to think of it now, I changed the language from German to English. After doing this, I noticed that OS X actually didn't rename the stuff in my home directory. So, when working with the shell, I can access it via the English directory names. However, when working with the Finder, everything is still shown in German. I haven't found the reason for this yet. Could this maybe be the problem? If so, how can I rename this stuff, so my Finder finds the actual directory? – Marcello Mönkemeyer Jul 9 '15 at 10:32
  • Nevermind, they're just symlinks I needed to rename... still working in the dark now. Everything is correctly named in English, and the shell does expand ~ to my home directory. Still, it doesn't find the source (which exists, though). It's driving me crazy right now... – Marcello Mönkemeyer Jul 9 '15 at 10:45
  • Okay, I fixed it. You were right: the guy who installed OS X for me did change and rename quite many things. I created a completely new user and it works now. Thank you for the essential hint. :) – Marcello Mönkemeyer Jul 9 '15 at 11:10

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.