git gui not working after installing in Mac (e.g. Mountain Lion)
When I ran git gui
, I got this:
$ git gui
git: 'gui' is not a git command. See 'git --help'.
Did you mean one of these?
grep
init
pull
push
But I ran other git commands fine, including gitk
. How can I fix this?
Thanks.
Solution 1:
Edit your git config to an add an entry for gui in the alias section
nano ~/.gitconfig
[alias]
gui = !sh -c '/usr/local/git/libexec/git-core/git-gui'
Edit 2020
It looks like the path in the original answer is now obsolete. Updated instructions:
[alias]
gui = !sh -c '/usr/local/opt/git/bin/git gui'
Solution 2:
This post: http://www.cmsimike.com/blog/2012/07/30/git-gui-and-osx-mountain-lion/ saves me.
Edit ~/.bash_profile
and put in
alias gui='/usr/local/git/libexec/git-core/git-gui'
Now the new command is gui
instead of git gui
.
EDIT (28 Jan 2013)
I have found a better answer to why git gui
wasn't working: Did Apple remove the 'git gui' command in XCode 4.5 command line tools?. Please refer to this solution instead.
Apple did indeed remove the 'git gui' command. I decided to just homebrew git instead of relying on the XCode command line tools.
brew install git
Then I edited the /etc/paths file to have the /usr/local/bin directory come before the /usr/bin directory, because that wasn't right either. Then exited the terminal window and restarted, and now I get:
$ which git
/usr/local/bin/git
$ git --version
git version 1.7.12.1
and the git gui command works again.
EDIT (2020-02-03)
As of version 2.25.0_1, git gui
is now provided by a separate formula in brew, named git-gui
. See the following PR and issues for the background to this change: https://github.com/Homebrew/homebrew-core/pull/49136
So along with installing Homebrew's git
, to have access to git gui
one must run
brew install git-gui