Ask Different is a question and answer site for power users of Apple hardware and software. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I reinstalled mountain lion recently and had to reset my git path. Everything was working fine until I realised I had to do it for every project so I tried to change the default system path by sudo bash -c '( echo /usr/local/git/bin > /etc/paths.d/git )'

Apparently I should have left it alone as I don't really know what I'm doing. My command prompt is now unknown-00-26-bb-0e-a8-1f:~ mantismamita$ (mantismamita is my username so that part is normal) and I have lost access to my aliases located in .bash_profile I'm also back to square one with my original problem as my git path is no longer correct. I should mention that I'm at a different IP address as I'm on holiday so that may have influenced the prompt.

I would be eternally grateful if someone could help me get out of this muddle.

share|improve this question
You need to restore /etc/paths.d/git from a backup or update OSX from the combo update as you have overwritten the Apple supplied file. The command should have had >> rather than > – Mark Aug 4 '13 at 10:16
so I could just run the combo update here : ? Or would I have to do something to restore the original path? – mantis Aug 4 '13 at 12:48
There is no /etc/paths.d/git on a plain installation so > or >> doesn't matter. I'm quite sure that the problem doesn't relate to the git path thing. Do you have network environments defined in Preferences? – patrix Aug 4 '13 at 12:52
no, the network I'm on is listed under system preferences but I haven't done anything to define it. Then again, I never had problems with my aliases other times I switched networks. – mantis Aug 4 '13 at 12:59
up vote 1 down vote accepted

I think these are not related. What you're seeing is the default bash prompt, which is defined in /etc/bashrc:

$ grep PS1=  /etc/bashrc
PS1='\h:\W \u\$ '

From the bash man page:

 \h     the hostname up to the first `.'
 \u     the username of the current user
 \W     the basename of the current working directory, with $HOME abbreviated with a tilde

What's happened is that your hostname is not being set correctly. It related to your network settings. It was discussed on superuser:

And on the /etc/paths.d/git file, what you did is correct. If you have git installed in /usr/local/git/bin, then the install usually creates that file for you. But the contents are trivial, so you can create it yourself. It should have a single line, containing the path to the bin directory you want added to PATH for all users:

$ ls -l /etc/paths.d/git
-rw-r--r--  1 root  wheel  19 Sep 17  2009 /etc/paths.d/git
$ od -ta /etc/paths.d/git
0000000    /   u   s   r   /   l   o   c   a   l   /   g   i   t   /   b
0000020    i   n  nl
$ wc -l /etc/paths.d/git
   1 /etc/paths.d/git
$ cat /etc/paths.d/git
share|improve this answer
Thanks Tim, I've changed networks again as I'm visiting some friends but everything seems to be back in working order. – mantis Aug 5 '13 at 23:36

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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