gitk
Mac
installation
Git
software tools

Install gitk on Mac

Master System Design with Codemia

Enhance your system design skills with over 120 practice problems, detailed solutions, and hands-on exercises.

Introduction

gitk is a lightweight graphical history viewer for Git, and on macOS the easiest installation path is usually Homebrew. The current practical package route is git-gui, which includes gitk, rather than looking for a separate gitk formula.

Check whether Git is already available

Before installing gitk, make sure basic Git tooling works:

bash
git --version

If Git is missing, install Xcode Command Line Tools:

bash
xcode-select --install

That gives you a baseline Git environment, but it does not always give you gitk.

Install with Homebrew

On current Homebrew setups, install git-gui:

bash
brew install git-gui

This package provides the Tcl or Tk user interface tools that include gitk.

After installation, confirm it is available:

bash
gitk --version
which gitk

If the command resolves correctly, the installation is done.

Launch gitk from a repository

gitk is normally run inside a Git repository:

bash
cd /path/to/repo
gitk

Useful variants:

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

These let you inspect all refs or a limited commit range.

If macOS cannot find the command

If brew install git-gui succeeded but gitk is still not found, check the active Homebrew prefix and your shell PATH.

bash
brew --prefix
echo $PATH

On Apple Silicon Macs, Homebrew is commonly under /opt/homebrew. On Intel Macs, it is often under /usr/local.

You can 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 following Homebrew's standard setup instructions.

Why git-gui and gitk are connected

gitk is historically part of the Tk-based Git GUI tooling family. That is why package managers may distribute it as part of git-gui rather than as a standalone package. This packaging detail trips people up because they search for gitk by name and do not immediately see the formula they expect.

From a user perspective, the important point is simple: on macOS with Homebrew, install the package that contains it, then run the gitk command normally.

Alternative installation paths

If you install Git from a bundled installer rather than Homebrew, gitk may or may not be included depending on the package. Homebrew is usually easier to reason about because the installed formula and binary locations are explicit.

If your team standardizes on Homebrew-managed developer tools, staying on that path also makes updates and onboarding easier.

Troubleshoot launch issues

If gitk starts but immediately exits or shows an empty interface, check the basics first:

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

When the problem is display-related rather than Git-related, reinstalling git-gui through Homebrew is usually faster than trying to patch a partial setup by hand.

Common Pitfalls

The most common mistake is searching Homebrew for a separate gitk formula instead of installing git-gui. Another is assuming that having git installed automatically means gitk is present too. Developers also sometimes install the package successfully but forget that their shell PATH is not loading the Homebrew prefix correctly. Running gitk outside a Git repository is another source of confusion because the tool then has nothing useful to display. Finally, people often overcomplicate the installation when the problem is simply that the wrong package name was searched.

Summary

  • On macOS with Homebrew, install gitk through brew install git-gui.
  • Verify installation with gitk --version and which gitk.
  • Run gitk from inside a Git repository for the normal workflow.
  • If the command is missing after install, inspect your Homebrew prefix and shell PATH.
  • Do not assume a basic Git installation always includes gitk.
  • Treat git-gui as the package source and gitk as the command you actually use.

Course illustration
Course illustration

All Rights Reserved.