This guide walks you through setting up a complete macOS development environment. Each step includes commands you can copy directly to your terminal, verification steps to confirm successful installation, and progress checkboxes that save your place automatically.

You'll install five essential tools in order: Homebrew (package manager), Git (version control), Node.js (JavaScript runtime), SSH keys (secure authentication), and VS Code (code editor). Start at the top and work down — each step builds on the previous one.

1 Install Homebrew

Homebrew is macOS's missing package manager. It simplifies installing and managing development tools, libraries, and applications from the command line. Install this first — many other tools depend on it.

Prerequisites

Ensure you have Xcode Command Line Tools installed. Run this command and follow any prompts:

$ xcode-select --install

Install Homebrew

Run this official installation script:

$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Follow the on-screen instructions. You may need to enter your password and press Enter to continue.

Add Homebrew to your PATH

After installation completes, you'll see instructions to add Homebrew to your PATH. The commands will look like this (run them exactly as shown in your terminal output):

$ echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.zprofile
$ eval "$(/opt/homebrew/bin/brew shellenv)"

Note: On Intel Macs, the path may be /usr/local/bin/brew instead of /opt/homebrew/bin/brew. Use the exact commands shown in your terminal output.

Verify installation

Confirm Homebrew is working:

$ brew --version

You should see output like Homebrew 4.x.x.

2 Configure Git

Git is the industry-standard version control system. It's likely already installed via Xcode Command Line Tools, but you need to configure your identity for commits and set up useful defaults.

Check if Git is installed

$ git --version

If not installed, install it via Homebrew:

$ brew install git

Set your identity

Replace the name and email with your own information:

$ git config --global user.name "Your Name"
$ git config --global user.email "your.email@example.com"

Set default branch name

Configure Git to use main as the default branch name for new repositories:

$ git config --global init.defaultBranch main

Verify configuration

Check your Git configuration:

$ git config --list

You should see your name, email, and default branch in the output.

3 Install Node.js

Node.js is a JavaScript runtime that lets you run JavaScript outside the browser. It includes npm (Node Package Manager), essential for modern web development. Even if you don't write JavaScript, many development tools require Node.js.

Install Node.js via Homebrew

$ brew install node

Verify installation

Check that both Node.js and npm are installed:

$ node --version
$ npm --version

You should see version numbers for both (e.g., v20.x.x for Node and 10.x.x for npm).

Update npm to latest

Optionally update npm to the latest version:

$ npm install -g npm@latest

4 Generate SSH Keys

SSH keys provide secure, password-free authentication for services like GitHub, GitLab, and remote servers. You'll use these keys to push code to repositories and connect to remote machines without typing passwords.

Check for existing keys

First, check if you already have SSH keys:

$ ls -la ~/.ssh

If you see files like id_ed25519 and id_ed25519.pub, you already have keys and can skip generation.

Generate a new SSH key

Create a new ED25519 SSH key (replace email with your own):

$ ssh-keygen -t ed25519 -C "your.email@example.com"

When prompted for a file location, press Enter to accept the default. When prompted for a passphrase, enter one (optional but recommended) or press Enter twice to skip.

Start the SSH agent

Start the SSH agent in the background:

$ eval "$(ssh-agent -s)"

Add key to SSH agent

Add your SSH private key to the agent:

$ ssh-add ~/.ssh/id_ed25519

Copy public key to clipboard

Copy your public key to add to GitHub, GitLab, etc.:

$ pbcopy < ~/.ssh/id_ed25519.pub

Your public key is now on your clipboard. Paste it into GitHub (Settings → SSH and GPG keys → New SSH key) or your preferred Git hosting service.

5 Install VS Code

Visual Studio Code is a powerful, free code editor with excellent support for hundreds of languages, built-in Git integration, and a vast extension ecosystem. It's become the most popular editor for web development.

Install VS Code via Homebrew

$ brew install --cask visual-studio-code

Add code command to PATH

Open VS Code, then press ⌘ + ⇧ + P to open the Command Palette. Type "shell command" and select Shell Command: Install 'code' command in PATH. This lets you open files and folders from the terminal.

Verify installation

Close and reopen your terminal, then test the code command:

$ code --version

You should see VS Code's version number. You can now open any project with code . from its directory.

Recommended extensions (optional)

Install popular extensions directly from the terminal:

$ code --install-extension dbaeumer.vscode-eslint
$ code --install-extension esbenp.prettier-vscode
$ code --install-extension eamodio.gitlens

Setup Complete

You now have a fully functional macOS development environment. Your machine is ready for web development, version control, and professional coding workflows.

Next Steps

Troubleshooting Resources