Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git gui not working after installing in Mac (e.g. Mountain Lion)

Tags:

git

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.

like image 628
Victor Avatar asked Jul 30 '12 13:07

Victor


People also ask

How do I start git GUI on Mac?

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.

How do I open git after installing Mac?

Go to Programs > Git and select Git Bash . We'll refer to both Mac's Terminal and Window's Git Bash as just Bash. You should have been returned a line with the version number, this means that git was correctly installed and is up and running!

Is there a git GUI for Mac?

GitFinder is a git GUI for macOS computers that run on macOS 10.11. 5+ operating systems. It combines a version control system or Git with a Finder module.


2 Answers

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'

like image 104
Drew Avatar answered Sep 29 '22 00:09

Drew


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 
like image 27
Victor Avatar answered Sep 28 '22 23:09

Victor