macOS / Linux Setup
- ▸Install or verify Python 3.10+ on macOS / Linux
- ▸Create and activate a .venv per session folder
- ▸Install dependencies and create your .env file
- ▸Run the first exercise end-to-end from the terminal
macOS and most Linux distributions ship with a built-in terminal and Python. You only need to make sure the Python version is recent enough and then create a virtual environment per session folder.
1. Check your Python version
You need Python 3.10 or newer (3.12+ recommended for Session 6). If the version is too old or you get "command not found", install Python first.
macOS — install Python with Homebrew
If you do not have Homebrew yet:
Ubuntu / Debian — install Python with apt
Fedora / RHEL — install Python with dnf
2. Open a terminal in the course folder
Navigate to the session folder you want to work on. Each session has its own requirements and .env, so always cd into the session first.
3. Create a virtual environment
This creates a .venv/ folder inside the session — a private copy of Python where we will install the dependencies. It never touches your system Python.
4. Activate the virtual environment
5. Install the session dependencies
This installs openai, python-dotenv, and any other libraries the session needs. Repeat this step once per session folder, because each one has its own requirements.txt.
6. Create your .env file
Open .env in your editor and paste your OpenAI API key (plus Anthropic and Google keys before Session 6). On macOS you can use any editor — here are a few ways:
- code .env — open in VS Code (recommended)
- nano .env — open in the built-in terminal editor
- open -e .env — open in TextEdit (macOS only)
OPENAI_API_KEY=sk-...your-key-here...
# Session 6 only
ANTHROPIC_API_KEY=sk-ant-...
GOOGLE_API_KEY=AIza...
# Optional overrides
OPENAI_MODEL=gpt-4o-mini7. Run your first script
If you see a response from the model, everything is wired up correctly. You are ready for Session 1.
Handy commands to remember
# Activate venv
source .venv/bin/activate
# Deactivate when done
deactivate
# See which Python is active
which python
# See installed packages
pip list
# Upgrade pip itself
python -m pip install --upgrade pip
# Run a script from the session folder
python src/01_text_basic.py --prompt "..."