Prepare Your Mac for Python Development
Landing Python on your Macintosh can be tricky. Here's how to install Parallels and Homebrew and stage the optimal development environment.
Feb 9th, 2025 8:00am by
MacOS and Python
I’ll provide specific commands where I can and suggestions otherwise. Admittedly, a few of these topics are basic common sense and best practice (such as managing software updates).Set Up My Mac
Take a few minutes to customize macOS the way you like it. Creating an efficient and comfortable user interface is essential to setting up an environment that works with you, not against you. Here are some common settings:- Clean up the Dock by removing the (many) apps Apple adds by default. Reduce the Dock to just the apps you use frequently. Add the programs you install later in this list for easy access.
- Set some inspirational wallpaper. I used the Python icon for motivation.
- Configure at least two Spaces. If you’ve never used Spaces, this is one of the most helpful macOS efficiency tools. Spaces are virtual desktops that exist offscreen. You can switch between them quickly, leaving specific applications open on each. I use four Spaces on my Macs.
- Adjust the display settings, font sizes and other visual settings to your preferences.
- Set trackpad and keyboard settings to your taste. There are several efficiency options around these two devices, so be sure to research those. I use multiple monitors at high resolutions, so I bump up the size of the pointer to make it easier to find on such a broad visual area.
Install Parallels Tools
My macOS/Python platform is a virtual machine. I use Parallels to host the various Linux and macOS VMs I use for my business. You could choose another virtualization platform, manage your Python projects on a physical Mac or use a non-Apple platform like Linux. Once I create my macOS/Python VM, I add Parallels Tools to ensure efficient communication. This doesn’t need to be a very powerful VM, as most Python applications are fairly small, especially when first starting out.Install Homebrew
Few general utilities will be as helpful as the Homebrew package manager. Linux users will already be familiar with package managers like DNF and APT, but if you’re new to this software management approach, get ready to be impressed. Package managers give you the ability to install applications quickly and easily. Homebrew also lets you install software that is not available on Apple’s App Store. Not all developers want to bend to Apple’s strict requirements, and not all software is ready for the App Store. Install Homebrew by typing the following command in the Terminal:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Hot-Rod the Terminal
You’ll likely spend a lot of time at the command prompt while developing programs. While GUI tools are wonderful, sometimes the CLI is the better choice. Apple’s built-in Terminal application is tolerable, but there are other options. My favorite is iTerm2. This highly customizable Terminal replacement offers many practical features — far too many to list here. Take a look at these standout options to get you started with iTerm2:- Split pane views.
- Extensive search capabilities.
- Autocomplete options.
- Customizable profiles for various projects. (Imagine a profile for Python development and another for file management tasks.)
Update Python3
The latest macOS (Sequoia) includes Python 3.9.6. However, you really should update your Python version to the latest version to address bug fixes in the older Apple version. Open the Terminal and type python3 to see the current version. It’s probably Python3 3.9.6 — woefully out of date compared to the 3.13.1 version that was current at the time I wrote this piece.
Python 3.9.6 is well out of date.
brew update
brew install python3
brew link python3
Use the most current Python3 version or one that suits your application.
Spend Time IDLE-ing
You should already have access to the default Python3 editor, IDLE. You can access it from the Terminal or the Launchpad. IDLE is a good basic editor, and it’s nice that Python3 includes it. However, I’m looking for something more robust.Install PyCharm Community Edition
I have nothing against the IDLE IDE, but I want to work with Python using PyCharm Community Edition from JetBrains. Download the .dmg file (scroll to the bottom of the page for the Community Edition) and drag the PyCharm CE icon into the macOS Applications folder. That’s it — a typical easy Mac program install. Customize the PyCharm CE user interface theme to taste and add any plug-ins you prefer. PyCharm also supports various other languages and includes a new AI support feature to explore. For those new to Python and PyCharm, the IDE contains a 40-lesson set of tutorials to get you started!
Consider the PyCharm CE IDE for your Python projects.
Install and Customize Vim
It may seem archaic, but I’m a big fan of the Vim text editor. There’s nothing quite like a basic text editor for getting things done without the distraction of wacky icons and 10,000 specialized features. As an author, I frequently just need to get words on paper (or screen, in this case), and Vim serves that purpose magnificently. Coding is a great example. Vim offers Python3 syntax highlighting, auto-indention and code folding to simplify your coding experience. To load these options automatically when Vim launches, I edit the ~/.vimrc file and add the following (use “ for comment lines):
" Syntax checking
syntax on
" Line numbering
set number
" Highlight cursor line
set cursorline
" Indentions
filetype indent on
" Folding
set foldmethod=indent
set foldlevel=99
My initial, slightly customized .vimrc file.
Vim with some Python syntax highlighting and line numbers.
Add the CotEditor
My latest favorite macOS application is CotEditor. I needed a basic GUI text editor to replace VS Code. I wanted something simple, graphical and (if possible) open source. And I found CotEditor. So far, this tool has been wonderful, and exactly what I need. You may or may not use it directly for coding, but it’s great for Markdown documentation or other basic editing projects.
The CotEditor is an excellent basic text editor.
Set Up venv for Python3 Projects
Python virtual environments help avoid dependency hell. Your various projects may require different modules or even different Python versions. Managing these rigid requirements systemwide would be challenging, so Python uses virtual environments (venv). Modules and other components installed in a venv are limited by its boundaries and do not affect other venvs. I typically create a new venv for each Python project. You will activate and deactivate the virtual environments as you change from project to project. The basic process to create and activate a venv for a project named “new-app” is:
mkdir new-app
cd new-app
python3 -m venv .venv
source venv/bin/activate
Wrap Up
You’re now ready to begin constructing Python projects on your Mac! As noted in the beginning, some of these tools and preferences are my own choices, so simply select the ones you like or are curious about and ignore the others. Macs make great dev platforms, and using a virtual machine is a handy way of experimenting with different tools and options. Get yourself rolling with macOS and Python today!
YOUTUBE.COM/THENEWSTACK
Tech moves fast, don't miss an episode. Subscribe to our YouTube
channel to stream all our podcasts, interviews, demos, and more.