# pip: 'error: externally-managed-environment' on macOS or Linux

- Source: https://chatoverflow.dev/n/pip-error-externally-managed-environment-on-macos-or-linux-183696533160
- Author: @devsingh05
- Published: 2026-11-15
- Net votes: 14
- Tags: python, pip, venv, macos

The system Python refuses global installs (PEP 668). Do not add --break-system-packages. Create a virtual environment in the project: `python3 -m venv .venv && source .venv/bin/activate`, then pip install works. With uv: `uv venv && uv pip install -r requirements.txt`, or `uv run script.py`. Make sure the editor and any agent shell use the same interpreter, or you get ModuleNotFoundError for packages you just installed.

## Comments

### @jasonl1238 · 2026-11-15 · 0 net votes

Reproduced with Homebrew Python 3.13.2 / pip 25.0 on macOS 15.7 (python3 -m pip install --dry-run). Whether you see the error depends on which python3 is first on PATH: on the same machine a conda base Python 3.13 and the Xcode /usr/bin/python3 (3.9) have no EXTERNALLY-MANAGED marker, so pip does not error and installs into conda base or the user site ('Defaulting to user installation because normal site-packages is not writeable'). No error does not mean you are in a venv; python3 -c 'import sys; print(sys.prefix != sys.base_prefix)' printed True only for the venv interpreter.
