An Integrated Development Environment, or IDE, is a piece of software which gives a software developer tools to write, test, and debug code and software.
Though all you technically need to begin writing software is a text editor, having access to the tools provided in an IDE will make the development process much faster and smoother.
This tutorial will go over how to install an IDE for Python. There are several commonly used ones, and you are free to choose whichever IDE suits your needs best.
For Python to run on your computer, you need to have a Python Interpreter installed first. This is the program which will execute any python files you write.
Remember, the IDE is only used for writing and debugging your programs. Actually running your python progams utilizes a python interpreter.
You will find that there are actually several different versions of the python interpreter. Any version above 3.x will generally suffice for most programs that you will write, unless there is a specific feature that you need.
Finally, there is a good chance that your computer already has a python interpreter preinstalled on it. If you want to check, skip down to the "verification" section.
All versions of MacOS come preinstalled with a python interpreter. However, depending on your OS version, it may be an older version, such as Python 2.7. I highly recommend installing your own python interpreter instead.
Here are some common installation methods
You can download an installer for a python interpreter from the official website:
Click the "download" button, and a .pkg file will be downloaded to your computer. Open it, and follow the installation instructions. Once complete, you will have a python interpreter installed on your computer!
Any MacOS user interested in programming should become familiar with the program "Homebrew." It's a type of program called a package manager, and makes the installation of new software easy and manageable.
Here is a link to the website for more information:
This program runs from the Terminal application on your Mac. We will become more familiar with the terminal as time goes on, and today we will use it to very quickly install a python interpreter.
Open the Spotlight application on your Mac, and search for "Terminal." Open it up, and you should see a screen like this:
To install Homebrew, you first need to install the xcode command-line tools by typing this script into the terminal:
This process may take a little while, and once it's done, you will then need to install Homebrew itself, by typing this into the terminal:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
This process will also take some time, and you will see lots of text spew out onto the terminal screen. It may also ask you for a password, which you need to type in.
Once the installation completes, you can check to see that Homebrew was installed by typing the following into the terminal:
You should see a help menu print to the terminal screen. This means that the installation was successful!
Now, installing a python interpreter, along with lots of other software, will be very easy. Type
brew install, followed by the name of any software you wish to install. For the python interpreter, type the following:
brew install python3
Verify that the python interpreter was installed on your computer by typing the following into the terminal:
This command tells you where any existing "python3" programs exist on your computer. If your Homebrew installation was successful, then the first (default) location will be under a folder called
/opt/homebrew/bin/python3 (silicon macs) or
/usr/local/bin/python3 (intel macs).
The system default version of python will be located at
To check which version of python you have installed, type the following into your terminal:
You can download a python interpreter from the official website:
Your choice of IDE is not super important. Most IDEs are functionally similar, but as you get into programming more, you may find a certain IDE to suit your needs more. As a beginner, any of these IDEs will suit your needs.
For the remainder of this series, I will be using VSCode, since VSCode can also be used with other programming languages, and is available on virtually any operating system
Visual Studio Code is a lightweight and highly customizable IDE for a variety of programming languages, and was developed by Microsoft. This is not to be confused with Visual Studio, a separate windows-only IDE built for C and C++ development.
Here are installation instructions for your operating system:
You can download the VSCode installer from the official website:
Select the "MacOS" download button, and have the installer guide you through the process.
Homebrew gives us the capability to install a variety of software for MacOS with a simple terminal command. Typing this into the terminal will automatically complete the installation process for VSCode:
brew install --cask visual-studio-code