This guide will help you set up your Mac for Python, data science and development work using modern tools.
Keeping your system updated ensures security and compatibility.
- Open System Settings → General → Software Update
- Install any available updates.
- Enable "Automatically keep my Mac up to date"
- Update apps via the App Store (Open App Store → Click Updates)
The Terminal is your command-line interface. Open it by pressing Cmd + Space and searching for "Terminal".
If you prefer, install iTerm2 for a more feature-rich terminal.
Xcode Command Line Tools are required for compiling packages, running Git, and using Homebrew.
-
Run the following command in the terminal:
xcode-select --install
-
A pop-up window should appear prompting you to install the tools. Click "Install" and follow the prompts.
-
Wait for the installation to complete (this may take a few minutes).
-
Verify the installation:
xcode-select --version
-
Check if essential developer tools like
git
are available:git --version
If you don’t see a pop-up or the command hangs, you can manually install Xcode Command Line Tools from System Settings → Software Update.
Homebrew simplifies installing development tools.
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
After installation, verify:
brew doctor
brew update
Run these commands in your terminal to ensure Homebrew is accessible:
echo >> ~/.zprofile
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"
Note: Environment variables such as API keys should be stored in your
~/.zshrc
or a separate.env
file for security. Avoid adding sensitive information directly to~/.zprofile
or~/.bash_profile
.
Recommended: Visual Studio Code (VSCode)
To enable VSCode from the Terminal:
- Open VSCode
- Cmd + Shift + P → Type "Shell Command: Install 'code' command in PATH"
- Install Git:
brew install git
- Configure your identity:
git config --global user.name "Your Name"
git config --global user.email "[email protected]"
- Authenticate GitHub with a Personal Access Token (PAT):
- Follow GitHub's guide
NVM allows easy version switching.
- Install NVM:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.5/install.sh | bash
- Add NVM to your shell config (
~/.zshrc
or~/.bashrc
):
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
- Restart your terminal or run:
source ~/.zshrc
- Verify installation:
nvm --version
- Install and use the latest LTS version of Node.js:
nvm install --lts
nvm alias default lts
Since macOS ships with a system Python, it's best to use pyenv to manage versions.
- Install
pyenv
:
brew install pyenv
- Set up
pyenv
by adding this to your shell config (~/.zshrc
or~/.bashrc
):
export PYENV_ROOT="$HOME/.pyenv"
command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init --path)"
- Restart your terminal or run:
source ~/.zshrc
- Install the latest Python version:
pyenv install 3.12.2
pyenv global 3.12.2
- Verify Python installation:
python --version
Note: Store environment variables such as API keys in
~/.zshrc
or a.env
file and useexport VAR_NAME=value
to set them. To load them automatically, addsource ~/.zshrc
at the end of your shell startup script.
uv
is a modern, faster replacement for pip, venv, and other dependency managers.
brew install uv
export UV_VENV_PATH=".venv"
uv venv
source .venv/bin/activate
If you have a requirements.txt
file:
uv pip install -r requirements.txt
For individual package installation:
uv add pandas numpy matplotlib jupyterlab
uv run jupyter lab
uv lock
uv sync
The easiest way to manage PostgreSQL with GIS support is via Postgres.app.
Alternatively, install it via Homebrew:
brew install postgresql postgis
brew services start postgresql
Download and install QGIS from its website:
brew install --cask qgis
Required for working with geospatial files.
brew install gdal
Verify installation:
gdalinfo --version
pip install numpy pandas matplotlib seaborn geopandas requests jupyterlab
brew install --cask docker
Open Docker Desktop and follow the setup instructions.
brew install fzf
$(brew --prefix)/opt/fzf/install
brew install ripgrep
If you prefer zsh (default on macOS), enhance it with:
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
brew install zsh-autosuggestions zsh-syntax-highlighting
Add this to ~/.zshrc
:
source $(brew --prefix)/share/zsh-autosuggestions/zsh-autosuggestions.zsh
source $(brew --prefix)/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
Apply changes:
source ~/.zshrc