Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git: command not found (on OS X 10.5)

Tags:

I am receiving this error when I try to use git lately. I'm not exactly sure when the error started as I rarely use git. I used to use it. I didn't change anything about it or my machine that I know of. Now it doesn't work.

I've gone through and reinstalled the latest version using this installer, and I still get the same error in terminal.

Anyone heard of this before? The installer runs just fine, no errors, but it still doesn't recognize the "git" command in terminal.

I'm running OS 10.5

EDIT

Per a response down below which pointed me to my PATH variable I think that's the issue. I installed MacPorts at one point, which changed my .profile I have no idea how to change it back though. My old .profile was this:

alias g='git'
export PS1='$(git branch &>/dev/null; if [ $? -eq 0 ]; then \
echo "\[\033[00m\]$(git branch grep ^*sed s/\*\ //) "; fi)\$\[\033[00m\] '
export LC_CTYPE=en_US.UTF-8
export PATH=$PATH:/usr/local/bin

My new .profile is this:

export PATH=/opt/local/bin:/opt/local/sbin:$PATH
export MANPATH=/opt/local/share/man:$MANPATH

How can I make those two files become one?

like image 294
James P. Wright Avatar asked Dec 02 '09 21:12

James P. Wright


Video Answer


2 Answers

From the page you linked to:

/usr/local/git/bin

Is that in your PATH?

Open ~/.profile in your favorite editor and add the line

export PATH=$PATH:/usr/local/git/bin

This appends the item to your PATH variable (separarated by colons), so it's compatible with other commands that modify the path.

like image 138
Josh Lee Avatar answered Oct 31 '22 18:10

Josh Lee


Had the same issue on mountain lion.

If yo're using XCode, run it. then go to XCode->preferences and install "Command Line Tools".

thats it, worked for me.

http://www.hongkiat.com/blog/mountain-lion-git-fix/

like image 25
Alon Shacham Avatar answered Oct 31 '22 17:10

Alon Shacham