Macos – Using git-gui on Mac with Homebrew

githomebrewmacos

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?

Best Answer

/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'
Related Question