Prerequisites
Before you begin, ensure you have:
- A Mac running macOS 10.15 (Catalina) or later
- Administrator access to your machine
- An internet connection
- At least 5 GB of free disk space
Note: Some steps require entering your password. You won't see characters appear when typing your password — this is normal security behavior.
Install Homebrew
Homebrew is the package manager for macOS. It simplifies installing and managing development tools.
Step 1: Install Xcode Command Line Tools
These are required for Homebrew and many development tools:
xcode-select --install
A dialog will appear asking you to install the tools. Click Install and agree to the license. This may take 10-15 minutes.
Verify installation
xcode-select -p
Expected output: /Library/Developer/CommandLineTools
Step 2: Install Homebrew
Run the official Homebrew installation script:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
The script will explain what it will do, then pause before continuing. Press Return to proceed.
Important: After installation completes, the script may display commands to add Homebrew to your PATH. Copy and run those commands exactly as shown.
Step 3: Add Homebrew to Your PATH
For Apple Silicon Macs (M1, M2, M3):
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"
For Intel Macs:
echo 'eval "$(/usr/local/bin/brew shellenv)"' >> ~/.zprofile
eval "$(/usr/local/bin/brew shellenv)"
Verify installation
brew --version
Expected output: Homebrew 4.x.x or similar
brew doctor
Expected output: Your system is ready to brew.
Install and Configure Git
Git is the version control system used by most development projects.
Step 1: Install Git
Use Homebrew to install the latest version of Git:
brew install git
Verify installation
git --version
Expected output: git version 2.x.x or similar
Step 2: Configure Git
Set your name and email address. These will appear in your commits:
git config --global user.name "Your Name"
git config --global user.email "your.email@example.com"
Note: Replace "Your Name" and "your.email@example.com" with your actual name and email.
Step 3: Set Default Branch Name
Configure Git to use main as the default branch name for new repositories:
git config --global init.defaultBranch main
Step 4: Configure Line Endings
Ensure consistent line endings across different operating systems:
git config --global core.autocrlf input
Verify configuration
git config --global --list
You should see your configured name, email, default branch, and autocrlf settings.
Install Node.js
Node.js is a JavaScript runtime required for many modern development tools and frameworks.
Step 1: Install Node.js via Homebrew
Install the latest LTS (Long Term Support) version:
brew install node
This installs both Node.js and npm (Node Package Manager).
Verify installation
node --version
Expected output: v20.x.x or similar
npm --version
Expected output: 10.x.x or similar
Step 2: Configure npm
Set npm to use a local directory for global packages to avoid permission issues:
mkdir -p ~/.npm-global
npm config set prefix ~/.npm-global
Add the npm global bin directory to your PATH:
echo 'export PATH=~/.npm-global/bin:$PATH' >> ~/.zprofile
source ~/.zprofile
Step 3: Test npm Installation
Install a global package to verify everything works:
npm install -g typescript
Verify global package installation
tsc --version
Expected output: Version 5.x.x or similar
Configure SSH Keys
SSH keys allow you to securely connect to GitHub, GitLab, and other services without entering your password each time.
Step 1: Check for Existing SSH Keys
First, check if you already have SSH keys:
ls -la ~/.ssh
If you see files named id_ed25519.pub or id_rsa.pub, you already have SSH keys. You can skip to Step 3 to add them to your services.
Step 2: Generate a New SSH Key
Create a new SSH key using the Ed25519 algorithm (recommended):
ssh-keygen -t ed25519 -C "your.email@example.com"
Note: Replace "your.email@example.com" with your actual email address.
When prompted:
- Enter file in which to save the key: Press Return to accept the default location
- Enter passphrase: Enter a secure passphrase (recommended) or press Return for no passphrase
- Enter same passphrase again: Re-enter your passphrase
If Ed25519 is not available
On older systems, use RSA instead:
ssh-keygen -t rsa -b 4096 -C "your.email@example.com"
Step 3: Add SSH Key to the SSH Agent
Start the SSH agent in the background:
eval "$(ssh-agent -s)"
Expected output: Agent pid xxxxx
Create or modify the SSH config file:
touch ~/.ssh/config
echo "Host *
AddKeysToAgent yes
UseKeychain yes
IdentityFile ~/.ssh/id_ed25519" >> ~/.ssh/config
Note: If you used RSA, replace id_ed25519 with id_rsa.
Add your SSH private key to the agent:
ssh-add --apple-use-keychain ~/.ssh/id_ed25519
Step 4: Copy Your Public Key
Copy your public SSH key to the clipboard:
pbcopy < ~/.ssh/id_ed25519.pub
Your public key is now in your clipboard, ready to add to GitHub, GitLab, or other services.
Display your public key
If you want to see your public key:
cat ~/.ssh/id_ed25519.pub
Step 5: Add Your SSH Key to GitHub
- Go to GitHub SSH Keys Settings
- Click New SSH key
- Enter a descriptive title (e.g., "My MacBook Pro")
- Paste your key into the "Key" field (it's already in your clipboard from Step 4)
- Click Add SSH key
Test your GitHub SSH connection
ssh -T git@github.com
You may see a warning about authenticity. Type yes to continue.
Expected output: Hi username! You've successfully authenticated...
Step 6: Add Your SSH Key to GitLab (Optional)
- Go to GitLab SSH Keys Settings
- Paste your key into the "Key" field
- Enter a descriptive title
- Set an expiration date (optional but recommended)
- Click Add key
Test your GitLab SSH connection
ssh -T git@gitlab.com
Expected output: Welcome to GitLab, @username!
Set Up VS Code
Visual Studio Code is a popular, free code editor with extensive extension support.
Step 1: Install VS Code
Install VS Code using Homebrew Cask:
brew install --cask visual-studio-code
Verify installation
Open VS Code from Spotlight (Cmd + Space, type "Visual Studio Code") or from Applications.
Step 2: Install the code Command
Add the code command to your PATH to open VS Code from the terminal:
- Open VS Code
- Press Cmd + Shift + P to open the Command Palette
- Type "shell command" and select Shell Command: Install 'code' command in PATH
- Restart your terminal
Test the code command
code --version
Expected output: Version number and commit hash
Open a directory in VS Code:
code .
Step 3: Install Essential Extensions
Install recommended extensions from the terminal:
Language Support
code --install-extension dbaeumer.vscode-eslint
code --install-extension esbenp.prettier-vscode
code --install-extension ms-python.python
code --install-extension golang.go
Git Integration
code --install-extension eamodio.gitlens
code --install-extension mhutchie.git-graph
Productivity
code --install-extension ms-vscode-remote.remote-ssh
code --install-extension ms-vscode.live-server
code --install-extension PKief.material-icon-theme
code --install-extension oderwat.indent-rainbow
Extension descriptions
- ESLint: JavaScript and TypeScript linting
- Prettier: Code formatting
- Python: Python language support
- Go: Go language support
- GitLens: Enhanced Git capabilities
- Git Graph: Visualize Git history
- Remote SSH: Connect to remote servers
- Live Server: Local development server
- Material Icon Theme: File icons
- Indent Rainbow: Colorize indentation levels
List installed extensions
code --list-extensions
Step 4: Configure VS Code Settings
Open VS Code settings file:
code ~/Library/Application\ Support/Code/User/settings.json
Add these recommended settings:
{
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.tabSize": 2,
"editor.wordWrap": "on",
"editor.minimap.enabled": true,
"files.autoSave": "onFocusChange",
"terminal.integrated.fontSize": 14,
"workbench.iconTheme": "material-icon-theme",
"git.autofetch": true,
"git.confirmSync": false
}
Note: Adjust these settings based on your preferences.
Next Steps
You now have a fully configured Mac development environment! Here are some suggested next steps:
Quick Tips
- Keep Homebrew updated: Run
brew update && brew upgraderegularly - Backup your SSH keys: Store them securely in case you need to set up a new machine
- Explore VS Code shortcuts: Press Cmd + K then Cmd + S to see all keyboard shortcuts
- Use
.gitignore: Always include a.gitignorefile in your projects