These instructions are for Mac OS X. A similar process probably applies for Windows; you may have luck with Spyder.
- The agent-based models (ABMs) here are written in Python 3. Your system likely has Python 2 pre-installed. Download and install the latest version of Python 3.
- Download and install TextMate
- Go to the “Variables” tab in Textmate’s preferences
- Add a new variable. Name it
TM_PYTHON
and set the value to /Library/Frameworks/Python.framework/Versions/3.7/bin/python3.7

- Open the .py file in Textmate and press Command-R – Python should launch, and the model should run.
- Pressing Command-Shift-R instead will bring up a Terminal window and give you command-line access to the model’s variables as it runs.
- If you get an error to the effect of
ImportError: "No module named 'something'"
:
- Install PIP
- Open the terminal and type
pip install something
where ‘something’ is the name of the missing module. (If this doesn’t work, try python3 -m pip install something
)
- Repeat the previous step until the model runs
