Set up Python 3.13 and uv on macOS

Basic python

Set up Python 3.13 and uv on macOS

Goals of this page #

  • Install Python 3.13 and uv on macOS Ventura / Sonoma
  • Learn how to create a virtual environment and manage libraries
  • Understand the key points when integrating with editors such as VS Code

Prerequisites #

ItemDetails
Required toolHomebrew (check with brew --version. If not installed, follow the official guide)
Shellzsh (default) or bash. This guide assumes zsh
Working folderWe will use ~/Projects/my-app

1. Install Python 3.13 #

brew update
brew install python@3.13
brew link python@3.13
python3.13 --version

You should see Python 3.13.x. If another version is linked, switch with brew unlink python@3.x.

2. Install uv #

curl -LsSf https://astral.sh/uv/install.sh | sh

Verify the command:

uv --version

If uv is not found, add ~/.local/bin to PATH.

echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc

3. Create the project folder and virtual environment #

mkdir -p ~/Projects/my-app
cd ~/Projects/my-app
uv venv --python 3.13 .venv
source .venv/bin/activate

When the prompt shows (.venv), the environment is active. Use deactivate to exit.

💡 You can also run commands without activating: uv run python script.py uses the environment automatically.

4. Install / sync libraries #

uv pip install numpy pandas
uv pip list
uv pip sync requirements.txt
  • uv pip install: add libraries
  • uv pip list: inspect what is installed
  • uv pip sync: rebuild from requirements.txt

5. Integrate with VS Code #

  1. Launch VS Code, open the Command Palette (⇧⌘P) and choose Python: Select Interpreter
  2. Pick .venv/bin/python so the editor uses your environment
  3. Recommended extensions: Python, Pylance, Black Formatter, Flake8 / Ruff

6. Common issues #

IssueFix
command not found: brewHomebrew is missing. Install it via the official script
uv not foundAdd PATH in ~/.zshrc (or shell rc) and source it
Permission error when creating the environmentCheck directory permissions (chmod, chown) and retry

7. Clean-up #

  • Leave the environment: deactivate
  • Delete the environment: rm -rf .venv
  • Save package list: uv pip freeze > requirements.txt

macOS now has Python 3.13 + uv ready. Compare with the other OS guides for reference:

When you’re ready, move on to the next lesson to start learning Python.