Install Tkinter on macOS

Step-by-step guide to installing Tkinter on macOS using Homebrew
Heads up! You've already completed this tutorial.

Before you start the Tkinter tutorial you will need to have a working installation of Tkinter on your system. If you don't have either set up yet, the following steps will guide you through how to install Tkinter on macOS.

This guide is also available for Ubuntu Linux. On Windows, Tkinter is installed by default with Python.

What Is Tkinter?

Tkinter is Python's standard GUI (Graphical User Interface) library. It provides a fast and easy way to create desktop applications with buttons, labels, text fields, menus, and more. Because Tkinter is included with most Python distributions, it's one of the most popular choices for building Python GUI apps.

On macOS, Tkinter is not always bundled with the system Python, so you may need to install it separately. The easiest way to do this is with Homebrew.

Install Tkinter on macOS Using Homebrew

To install Python and Tkinter on macOS I recommend you use Homebrew. Homebrew is a package manager for command-line software on macOS. Homebrew has both Python 3 and Tkinter available in their repositories, making it the easiest way to get everything set up.

Homebrew -- the missing package manager for macOS Homebrew -- the missing package manager for macOS

Install Homebrew

To install Homebrew, run the following from the command line --

sh
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

This is also available to copy and paste from the Homebrew homepage.

Install Python 3

Once Homebrew is installed you can then install Python 3 with --

sh
brew install python3

Install Tkinter

With Python installed, you can then install Tkinter using Homebrew with --

sh
brew install python-tk

Once this completes, you'll have a fully working Tkinter installation on macOS.

Verify Your Tkinter Installation

To confirm that Tkinter is installed correctly, open a terminal and run the following command:

sh
python3 -c "import tkinter; tkinter._test()"

If a small test window appears, your Tkinter installation is working and you're ready to start building Python GUI applications on macOS.

Troubleshooting Common Tkinter Installation Issues on macOS

If you run into problems, here are a few common issues and fixes:

  • ModuleNotFoundError: No module named 'tkinter' — This usually means you're running a version of Python that doesn't have Tkinter bundled. Make sure you're using the Homebrew-installed Python (python3) and that you've run brew install python-tk.
  • Tkinter window doesn't appear — On some macOS versions, you may need to grant terminal or IDE permissions under System Settings > Privacy & Security.
  • Using the wrong Python version — Run which python3 to confirm you're using the Homebrew version (typically /opt/homebrew/bin/python3 or /usr/local/bin/python3) rather than the macOS system Python.

Next Steps

With Tkinter installed on your Mac, you're ready to start creating Python GUI applications. Check out our Tkinter tutorial to learn the fundamentals and build your first desktop app with Python.

Well done, you've finished this tutorial! Mark As Complete
[[ user.completed.length ]] completed [[ user.streak+1 ]] day streak

Packaging Python Applications with PyInstaller by Martin Fitzpatrick

This step-by-step guide walks you through packaging your own Python applications from simple examples to complete installers and signed executables.

More info Get the book

Martin Fitzpatrick

Install Tkinter on macOS was written by Martin Fitzpatrick.

Martin Fitzpatrick has been developing Python/Qt apps for 8 years. Building desktop applications to make data-analysis tools more user-friendly, Python was the obvious choice. Starting with Tk, later moving to wxWidgets and finally adopting PyQt. Martin founded PythonGUIs to provide easy to follow GUI programming tutorials to the Python community. He has written a number of popular Python books on the subject.