git gui not working after installing in Mac (e.g. Mountain Lion)
GitGit Problem Overview
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.
Git Solutions
Solution 1 - Git
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 - Git
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: https://stackoverflow.com/questions/12667936/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
Solution 3 - Git
Seems like in mid-2021 all answers got obsolete (even mine!), so here's my new answer:
brew install git-gui || brew upgrade git-gui
git gui || /usr/local/opt/git/bin/git gui
OLD ANSWER: Seems like in late 2017 all answers above got obsolete, so here's my new answer:
brew install git || brew upgrade git
git gui || /usr/local/opt/git/bin/git gui
Solution 4 - Git
2020
brew install git
brew install git-gui
git config --global --add alias.gui '!sh -c '/usr/local/opt/git/libexec/git-core/git-gui''
Now, enjoy:
git gui
Solution 5 - Git
You might need to install/upgrade separately the git-gui package after installing Mountain Lion.
As mentioned in "Git GUI client for Linux", git gui
has its own package (beside git-core
).
From the comments, it seems a git-gui package isn't yet available for Mountain Lion.
However, this post report making work an alternative gui like Source Tree.
That could be a good workaround.
Solution 6 - Git
I have the same issue. Git-gui appears still installed for me (/usr/local/git/libexec/git-core/git-gui is my location) but it doesn't just work without specifying the full path. This indicates a path issue, but I've not looked into it much further.
edit Try adding /usr/local/git/libexec/git-core to the beginning of your PATH variable. Looks like all the git binaries are there so that should work.
Solution 7 - Git
Adding to the path worked for me.
I just added this line to my ~/.profile and git gui is alive once again. &(%ing mountain lion. export PATH=PATH:/usr/local/git/libexec/git-core
Solution 8 - Git
In addition to Victor's answer above, you need to an additional step, because brew install git didn't create simlink for git-gui.
Inside /usr/local/bin, run the following:
ln -s ../Cellar/git/1.8.3.2/libexec/git-core/git-gui git-gui
(Replace git version with your own)
Solution 9 - Git
While I am not sure how to open git gui from the terminal in Mountain Lion it is possible to use it using OpenInGitGUI which opens git gui from Finder. The download and instructions are available here.
This may not be quite as convenient as typing 'git gui' in the terminal but it is pretty close. Basically all you need to do is type 'open .' to open the current directory in Finder and then click the Git button to open up git gui.