Using git-gui on Mac with Homebrew

I have Git installed with Homebrew.

However, git-gui doesn't seem to come stock in /usr/local/bin.

This answer suggests I should create an alias to usr/local/git/libexec/git-core/git-gui, but this file doesn't exist.

The only executable I can find is located in

/usr/local/Cellar/git/1.8.4/share/git-gui

Now this is the alias I used. However, if I ever update Git, I'll have to relink it.

How do I get a permanent reference to git-gui?


/usr/local/opt/ contains symlinks to the directories in /usr/local/Cellar/:

$ ll /usr/local/opt/git
lrwxr-xr-x  1 lauri  admin    19B Oct 11 17:07 /usr/local/opt/git -> ../Cellar/git/1.8.4
$ ll /usr/local/opt/git/libexec/git-core/git-gui
-rwxr-xr-x  2 lauri  admin   205B Sep 18 23:28 /usr/local/opt/git/libexec/git-core/git-gui

Check the file exists, then add something like this to ~/.gitconfig:

[alias] 
gui = !sh -c '/usr/local/opt/git/libexec/git-core/git-gui'

Since version 2.25.0_1 of the git formula on Homebrew, the git gui functionality has been separated out into the git-gui formula. See the following pull request for background on this change: https://github.com/Homebrew/homebrew-core/pull/49136

Because of this, a better solution for to fix a broken git gui on a Homebrew installation of git is to run:

brew install git-gui