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:
If Git is missing, install the Xcode Command Line Tools:
That gives you Git, but not always gitk.
Install with Homebrew
This package provides the Tcl/Tk interface tools, which include gitk. Confirm it is on your PATH:
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:
Useful variants to view all refs or a limited commit range:
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:
On Apple Silicon Macs, Homebrew usually lives under /opt/homebrew. On Intel Macs, it's often /usr/local.
Inspect the binary location directly:
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 statusto make sure the repository is readable - try
gitk --allto 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
gitkformula instead of installinggit-gui. - Assuming an installed
gitmeansgitkis present too. - Installing successfully but having a shell
PATHthat doesn't load the Homebrew prefix. - Running
gitkoutside a Git repository, where it has nothing to display.
Related reading
- Install TensorFlow with specific version on Anaconda
- Installing git on Windows Git Bash Here or git-cheetah shell extension?
- Installing specific package version with pip
- IntelliJ and Git Branch Name
- Intellij git revert a commit
- IntelliJ IDEA with Git remember author
- intellij incorrectly saying no beans of type found for autowired repository
- iOS 10 App if we're in the real pre-commit handler we can't actually add any new fences due to CA restriction
.png&w=3840&q=75)
Tackling System Design Interview Problems
A short course that equips you with the skills to approach system design interviews methodically.
Start the free courseNo 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 courseInterview Questions practice on Codemia
Over 11,000 interview practice questions for 300+ companies, searchable by company and role.