I can't open .py files in IDLE by double-clicking them in Finder (IDLE is currently set as the default program for opening such files). Nor can I open those files by right-clicking and selecting IDLE.

If IDLE is already open I can open .py files through the File > Open method. Once IDLE is open I can also just double-click .py files and they will open in IDLE. Finally, in the Terminal, I can open .py files just fine by typing idle -e file.py even if IDLE has not yet been opened.

I just can't open IDLE itself by double-clicking on .py files, or by right-clicking on .py files and selecting IDLE.

I'm using OSX 10.8.2 and Python/IDLE 2.7.3. Anyone know how I can fix this?

  • env PATH=/usr/bin:/bin:/usr/sbin:/sbin idle file.py works for me, I can't check your version since I have not installed Tkinter for my Python3.3 I use. Have you installed other python than default?
    – Eir Nym
    Mar 9, 2013 at 22:51
  • @EirNym, I had Python 2.7.3 and Python 2.6 (from python.org) installed on my machine, and then I uninstalled both and re-installed OSX and XCode. Then I reinstalled Python 2.7.3 (again from python.org). In which file are you setting the path in your comment?
    – GChorn
    Mar 12, 2013 at 2:41
  • As IDLE is a GUI it won't look at any change in your path in .profile files - does the Apple IDLE work?
    – mmmmmm
    Mar 13, 2013 at 16:07

2 Answers 2


You can right-click on a python file and select get info. Near the bottom of the get info window is a section that reads Open With. You can select a version of Idle to use. There is a button below that reads change all. If you click this, then all files with .py extension will be opened with idle. Just tested this and it works. Below is an image indicating the relevant points.

enter image description here

  1. You don't need to install python 2.7.3 on ML since it's default.
  2. If you really need custom installation of python (if you need special site packages for example), you need to install it from mac ports or from home brew (I do prefer mac ports). And rule custom packages from that location.
  3. To make IDLE runnable from your python installation you have to resolve all dependencies such as TKinter.

Package systems such as Brew and MacPorts and others often split Python base to python core, python-tk and python-sqlite3 depending on the package manager and maintainer opinion. Package name may vary and easily searchable.

  • I'm really confused. When I installed ML, the default version of Python I got (when I typed "python" at the command line) was 2.7.2, not 2.7.3. Also I wasn't aware that IDLE came pre-installed on ML. Based on your answer, I'm no longer sure how to tell the ML pre-installed Python/IDLE versions from the python.org ones.
    – GChorn
    Mar 21, 2013 at 9:30
  • You can freely to remove python from python.org and install from MacPorts if you need different python to setup site packages
    – Eir Nym
    Mar 21, 2013 at 19:40
  • You can install python 2.7.16 and python3 directly from python.org as an installer .pkg, without having to use HomeBrew or Mac Ports. Those installers include IDLE.
    – benwiggy
    Jan 12, 2020 at 18:58
  • 1
    Thank you! brew install python-tk worked for me. Jan 3, 2022 at 9:47
  • 1
    @EirNym Thjis site is for Apple products so only macos matters here what happens on Linux or FreeBSD is just a confusion and in this question it really does not help
    – mmmmmm
    Jan 4, 2022 at 18:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .