I just upgraded my Mac to Mac OS X v10.7 (Lion), and now Git is gone:
$ git
-bash: git: command not found
How can I get Git back?
I just upgraded my Mac to Mac OS X v10.7 (Lion), and now Git is gone:
$ git
-bash: git: command not found
How can I get Git back?
The default install location is /usr/local, so add this to your ~/.bash_profile file:
export PATH=$PATH:/usr/local/git/bin/
Then run source ~/.bash_profile
in Terminal.
PATH=/usr/local/git/bin:$PATH
to your ~/.bash_profile but I can't seem to find (or access .bash_profile). I tried typing ~/.bash_profile
in Terminal but got "Permission denied." I don't otherwise know how to access the .bash_profile (I tried using sudo but it's either not possible or I'm using the wrong sudo commands). I would greatly appreciate help in updating/accessing ~/.bash_profile
~/.bash_profile
might be just ~/.profile
Sep 12, 2011 at 21:14
If you do not want to install Xcode and/or MacPorts/Fink/Homebrew, you could always use the standalone installer: https://sourceforge.net/projects/git-osx-installer/
You have to find where the Git executable is and then add the folder to the PATH environment variable in file .bash_profile.
Using terminal:
Search for Git:
sudo find / -name git
Edit the .bash_profile file. Add:
PATH="<Directory of Git>:$PATH"
Git is back :-)
Anyway, I suggest you to install Git using MacPorts. In this way you can easily upgrade your Git instance to the newest release.
git's directory
after the path in order to avoid eventual conflicts
Feb 24, 2014 at 8:44
There are a couple of points to this answer.
Firstly, you don't need to install Xcode. The Git installer works perfectly well. However, if you want to use Git from within Xcode - it expects to find an installation under /usr/local/bin. If you have your own Git installed elsewhere - I've got a script that fixes this.
Second is to do with the path. My Git path used to be kept under /etc/paths.d/
However, a Mac OS X v10.7 (Lion) install overwrites the contents of this folder and the /etc/paths
file as well. That's what happened to me and I got the same error. Recreating the path file fixed the problem.
git
$not$ at /usr/local/bin
but rather at /Applications/Xcode.app/Contents/Developer/usr/bin
.
You can always use MacPorts...
PATH
?