Setting up Git, Python, and VS Code on macOS
Setting up your macOS development environment
This guide will walk you through installing and configuring Git, Python, and Visual Studio Code on macOS.
1. Installing Homebrew (Recommended)
Homebrew is a package manager for macOS that makes installing development tools much easier. While not strictly required, it’s highly recommended.
1.1. Install Homebrew
- Open Terminal (press
Cmd+Space
, type “Terminal”, and press Enter) - Visit https://brew.sh or run this command:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
- Follow the on-screen instructions
- After installation, you may need to add Homebrew to your PATH. The installer will provide the exact commands, which typically look like:
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"
Note: The path differs for Apple Silicon Macs (/opt/homebrew
) vs Intel Macs (/usr/local
).
1.2. Verify Homebrew installation
brew --version
You should see output like: Homebrew 4.x.x
2. Installing Git
Git comes pre-installed on macOS, but it’s often an older version. We’ll install a more recent version using Homebrew.
2.1. Check if Git is already installed
git --version
If Git is installed, you’ll see the version number. If not, macOS may prompt you to install Command Line Tools.
2.2. Install Git via Homebrew (recommended)
brew install git
2.3. Alternative: Install Command Line Tools only
If you don’t want to use Homebrew, you can install Apple’s Command Line Tools, which includes Git:
xcode-select --install
A dialog box will appear asking you to install the tools. Click “Install” and follow the prompts.
2.4. Verify Git installation
Close and reopen Terminal, then run:
git --version
You should see: git version 2.x.x
(or newer)
To check which Git is being used:
which git
If you installed via Homebrew, it should show /opt/homebrew/bin/git
(Apple Silicon) or /usr/local/bin/git
(Intel).
2.5. Configure Git
Set up your Git identity:
git config --global user.name "Your Name"
git config --global user.email "your.email@example.com"
3. Installing Python
macOS comes with Python pre-installed, but it’s typically Python 2.7 (on older systems) or an older Python 3 version. It’s best to install a current version.
3.1. Check current Python version
python3 --version
3.2. Install Python via Homebrew (recommended)
brew install python
This installs the latest Python 3.x and pip.
3.3. Alternative: Install from python.org
- Visit https://www.python.org/downloads/macos/
- Download the latest stable macOS installer
- Run the downloaded
.pkg
file - Follow the installation wizard
- The installer will place Python in
/usr/local/bin
or/Library/Frameworks/Python.framework/
3.4. Verify Python installation
python3 --version
You should see: Python 3.x.x
Check pip:
pip3 --version
You should see: pip x.x.x from ...
3.6. Update pip
pip3 install --upgrade pip
4. Installing Visual Studio Code
4.1. Install via Homebrew (recommended)
brew install --cask visual-studio-code
4.2. Alternative: Download from website
- Visit https://code.visualstudio.com/
- Click “Download for macOS”
- Open the downloaded
.zip
file - Drag “Visual Studio Code.app” to your Applications folder
- Open VS Code from Applications or Spotlight