top of page

The Pythonista’s Guide to Setting Up a Mac for 🐍 Python 🐍 Development


Photo by Tyler B on Unsplash

The first (and last) time I set up a personal computer for software development was seven years ago, in the spring of 2016, and I had no idea what I was doing. I was new to the world of software and programming, having just decided to exit my first career as an ESL and College Composition teacher. I barely had a handle on HTML and CSS. I think my husband probably took care of making sure that I had an IDE and SSL connection to GitHub.


The first (and last) time I set up a computer for Python 🐍 development was over three years ago, and that was for a job. The setup documentation was legit amazing, and I remember that I didn’t run into a single snag setting up my machine, despite being totally new to Python. Because there was no need to troubleshoot issues (and because I was overwhelmed just trying to do basic things with the language and development environment), there was no need (and no time) to slow down and really understand what I was putting on my machine.


Which put me in the tenuous position of (somehow) ending up in a string of senior Python roles (Director of Engineering, Senior Software Engineer, Technical Lead) without having formed a strong mental model (nor strong opinions) on how to set up a machine for Python development.


Overall, not a good position to be in 😱


Well, I've finally replaced my original development machine that I bought over seven years ago, and with a fresh machine and a seven-years-more-mature mental model, I’m taking this opportunity to do the following:


  • Deeply understand what I want and need on my machine for Python development

  • Formulate opinions about why I’m installing one technology over another

  • Move slowly through the installation process to solidify my procedural knowledge


I think these are skills every mid-level and senior software engineer should have, but they’re tough to develop through hands-on experience unless you have a new personal machine to set up. When you’re onboarding to a new job, you have to install many things according to documented guidelines. And you’re typically trying to get up and running as quickly as possible, and thus don’t slow down to deep dive into any new technologies.


So, here it is: My carefully compiled list of things I installed on my new personal machine, in the order that I installed them, with some notes on why I chose that technology.


Homebrew

Most software developers prefer to use package management software to install, update, and remove software on their operating systems. The alternative is to use the operating system graphical user interface (GUI). On a Mac, this is what's happening when you're asked to drag applications that you've downloaded via a Web page into the Applications folder using the mouse cursor.


macOS doesn't come with built-in package management software, unfortunately, and so you're essentially forced to use the GUI. Linux users have built-in options for installing packages and applications via the terminal, like yum and apt. But we macOS users need to install software to manage packages on our machines, and for this, Homebrew has become the de facto package manager.


There are many great informational resources on Homebrew. Here are a few that I consulted as I worked to set up my machine:



iTerm2

Terminal is a program that provides a command-line interface to macOS. It comes pre-installed on macOS, but many bemoan its lack of features and potential for customization.


iTerm2 is a terminal emulator for macOS, and is much more popular than the built-in Terminal. It supports opening multiple panes in a single window, which can be a huge productivity booster for us software developers. It’s also very customizable in appearance, default window & pane settings, and custom keybindings.


Here are some resources I consulted when deciding to install and use iTerm2 over the built-in Terminal:



Oh My Zsh

Oh My Zsh is an open source framework that makes managing your Zsh configuration easy and -- to be honest -- really fun. With Oh My Zsh, you have access to hundreds of themes (I use the built-in clean theme and make a few modifications to the color scheme to suit my preferences) and plugins (like zsh-syntax-highlighting) that can brighten your terminal window and help maximize your productivity.


These are the main resources I used to learn about and get Oh My Zsh set up:



pyenv

pyenv is a tool that allows you to easily install and manage multiple versions of Python so that you don't waste time debugging pesky dependency issues in your development environment. Although homebrew can be used to install Python, pyenv is superior to these package managers because they typically install packages into the global system space, whereas pyenv installs Python versions into your user space and makes it incredibly easy to switch between them and even remove them once you're finished developing with a specific version.


Why would you want multiple versions of Python on your machine? Well, you may be curious about the latest Python release and eager to try out its new features. Or, you may be interested in contributing to open source projects, each of which will have a specific version of Python that may be different than the others.


Here's the official documentation for pyenv, which includes a stellar overview of just how exactly it works:


RealPython has a fantastic tutorial on pyenv that I recommend for understanding why we would use pyenv, how to install it, and how to use it. It was published in 2019, but in my experience of getting pyenv set up on my new machine, has aged well:

Please note that Python no longer comes installed on macOS, and so any time you see reference to "system Python" in these tutorials, they're referring the previously pre-installed version.

Python

Once I installed pyenv, I decided to install two different versions of Python on my machine:

  • 3.11.2

  • 3.12-dev

Version 3.11.2 is the latest stable version of Python, and -- as the version name indicates -- 3.12-dev is the latest development release. I wanted to be able to preview upcoming features and changes to Python, which is why I installed the dev release. Once that release is finalized and officially released, I'll remove 3.12-dev and replace it with 3.12.


Visual Studio Code


Technically, we're ready to rock and roll with Python development on our machine, but only if you're using vim or TextEdit to write code.


I've been using PyCharm at work for the last couple years, but am interested in giving the open-source code editor VSCode a whirl. I plan on eventually building full-stack applications on this machine, and VSCode has built-in support for TypeScript and Node.js, as well as many extensions to make Python development easier and more enjoyable.


I installed VSCode using -- you guessed it -- Homebrew 😎


Summary


And that's it for now! There are a ton of extensions and plugins that I can and will install for many of these tools, and other things that I'll install selectively once I start working on specific software projects (like PostgreSQL, Postman, etc.), but for now, this is pretty much all I need to get up and running for basic Python development.

bottom of page