gitk
Mac
installation
Git
software tools

How to install gitk on Mac with Homebrew

Codemia Knowledge Hub ·

On macOS, install gitk with Homebrew by running brew install git-gui. The git-gui package includes gitk, so don't look for a separate gitk formula. Then run gitk from inside any Git repository.

Check that Git works

Confirm basic Git tooling first:

bash
git --version

If Git is missing, install the Xcode Command Line Tools:

bash
xcode-select --install

That gives you Git, but not always gitk.

Install with Homebrew

bash
brew install git-gui

This package provides the Tcl/Tk interface tools, which include gitk. Confirm it is on your PATH:

bash
which gitk

If the command resolves, you're done. (gitk has no --version flag; it is a Tcl script that ships with Git, so git --version tells you which release you have.)

Launch gitk from a repository

gitk normally runs inside a Git repository:

bash
cd /path/to/repo
gitk

Useful variants to view all refs or a limited commit range:

bash
gitk --all
gitk HEAD~20..HEAD

If macOS cannot find the gitk command

If brew install git-gui succeeded but gitk isn't found, check the Homebrew prefix and your shell PATH:

bash
brew --prefix
echo $PATH

On Apple Silicon Macs, Homebrew usually lives under /opt/homebrew. On Intel Macs, it's often /usr/local.

Inspect the binary location directly:

bash
brew --prefix git-gui
ls "$(brew --prefix git-gui)/bin"

If needed, add the Homebrew shell environment to your shell startup file using Homebrew's standard setup instructions.

Why gitk ships inside git-gui

gitk belongs to the Tk-based Git GUI tooling family, so package managers may distribute it as part of git-gui rather than on its own. People search Homebrew for gitk by name and don't see the formula they expect. Install the package that contains it, then run gitk as usual.

Other ways to get gitk

If you install Git from a bundled installer instead of Homebrew, gitk may or may not be included depending on the package. Homebrew is easier to reason about because the formula and binary locations are explicit, and it keeps updates and onboarding simple if your team already uses Homebrew for developer tools.

gitk opens but shows nothing or exits

Check the basics:

  • confirm you are inside a Git repository
  • run git status to make sure the repository is readable
  • try gitk --all to include all refs

If the problem is display-related rather than Git-related, reinstalling git-gui through Homebrew is usually faster than patching a partial setup by hand.

Mistakes that keep gitk missing

  • Searching Homebrew for a separate gitk formula instead of installing git-gui.
  • Assuming an installed git means gitk is present too.
  • Installing successfully but having a shell PATH that doesn't load the Homebrew prefix.
  • Running gitk outside a Git repository, where it has nothing to display.

Free course
Beginner
7 lessons
2 hours
Tackling System Design Interview Problems

A short course that equips you with the skills to approach system design interviews methodically.

Start the free course
Basis Lab
No course covers this one yet

Basis Lab writes one for you from a sentence about what you want to be able to do, then teaches it and checks you understood. Your first course is free.

Build my course
Interview Questions practice on Codemia

Over 11,000 interview practice questions for 300+ companies, searchable by company and role.

Browse interview questions