Run Python 3 in TextMate (Mac)

I was having an issue with TextMate 2.0 in that it runs Python 2, even after installing IDLE with Python 3. For example:

print("Total:", a)

Resulted in: (‘Total:’, 5)

Instead of: Total: 5

From what I read, it is best to have TextMate use Python 3 on a per project basis; changing defaults can break other parts since it uses Python 3. 

The solution here from “philbernt” was the most straight-forward solution.

First, launch terminal and type:

which python3

On my machine the following was returned:


In your TextMate document, after selecting Python as the document type, copy and past the result from Terminal, proceeded by “#!”. In my example this would be:


Use Command R to run and it should now run with the latest version of Python.