How to Setup Python on Mac Without Homebrew
Posted on April 9, 2025 from Kalama, WashingtonThis post shows you how to setup Python on a Mac without using Homebrew.
This includes installing the following:
- A specific version of Python. In this case, Python 3.12.
- pip for package management
- Poetry for dependency management
Uninstall Homebrew Python
If you have Homebrew installed and previously installed Python or a package that depends on Python, you may need to uninstall it first. This is important because Homebrew's Python installation can conflict with the system Python.
brew uninstall [email protected]
What should be left is the default Python that comes with macOS (version 3.9). You can confirm this by running:
python3 --version
Install Python
In this case, we'll be installing Python 3.12 but you may opt for a different version.
Download and install the pkg from https://www.python.org/downloads/macos/.
Install certificates
After installing Python, you may need to install the certificates. This is important for SSL connections and other security features.
cd /Applications/Python\ 3.12/
./Install\ Certificates.command
Upgrade pip
After installing Python, you may need to upgrade pip to the latest version. This is important for package management
pip3 install --upgrade pip
Install Poetry
Poetry is a dependency management tool for Python. It allows you to manage your project's dependencies in a simple and consistent way.
Install Poetry using the following command:
curl -sSL https://install.python-poetry.org | python3 -
By default, Poetry will be installed in ~/Library/Application Support/pypoetry
and added to the PATH (~/.local/bin
).
You may need to create a symbolic link so Poetry can find the python
executable:
cd /Library/Frameworks/Python.framework/Versions/3.12/bin
ln -s python3 python
Verify the Poetry installation:
poetry --version
Initialize a new Poetry project
After installing Poetry, you can create a new project using the following command:
poetry init
Adding dependencies
To add a dependency to your project, use the following command:
poetry add package_name