Setting Up Your Development Environment on Mac

A well-configured development environment makes coding significantly easier and more enjoyable. Taking time to set up your tools properly will save you hours of frustration later.

As a Mac user, you're already in a good position for development work. macOS comes with many developer-friendly features built-in, and setting up your environment is relatively straightforward. This section will guide you through setting up everything you need for effective vibe coding.

Terminal Setup

The Terminal app is your command center for development tasks. Here's how to get started:

Basic Terminal Configuration

  1. Open Terminal: Find it in Applications > Utilities > Terminal, or use Spotlight (Cmd+Space) and type "Terminal"

  2. Install Command Line Tools: Run this command to install essential development tools:

    xcode-select --install

    This installs Git and other developer tools without requiring the full Xcode application.

  3. Install Homebrew: Homebrew is a package manager that makes it easy to install development tools. Install it with:

    /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
  4. Configure your PATH: After installing Homebrew, make sure to follow the instructions it displays to add it to your PATH.

Essential Terminal Commands

Here are some commands you'll use frequently:

Command Description
cd [directory] Change to a specific directory
cd .. Move up one directory
ls List files in current directory
ls -la List all files (including hidden ones) with details
mkdir [name] Create a new directory
touch [filename] Create a new empty file
rm [filename] Remove a file
rm -rf [directory] Remove a directory and all its contents (use with caution!)
cp [source] [destination] Copy a file
mv [source] [destination] Move or rename a file
cat [filename] Display file contents
nano [filename] Edit a file using a simple text editor

Code Editor Setup

A good code editor with AI capabilities will dramatically improve your productivity. The right editor can help you write better code faster and catch errors before they become problems.

While you mentioned using Cursor, which is excellent for AI-assisted coding, here's how to set up some popular alternatives:

Visual Studio Code

VS Code is highly recommended for its balance of features, performance, and AI integration:

  1. Install VS Code: Download from code.visualstudio.com or use Homebrew:

    brew install --cask visual-studio-code
  2. Essential Extensions:

    • GitHub Copilot: AI pair programming assistant
    • Prettier: Code formatter
    • ESLint: JavaScript linter
    • Live Server: Launch a local development server
    • Auto Rename Tag: Automatically rename paired HTML tags
    • Path Intellisense: Autocompletes filenames
  3. Configure Settings: Press Cmd+, to open settings, where you can customize editor behavior.

Cursor

Since you mentioned Cursor, here are some tips for optimizing it:

  1. Install Cursor: Download from cursor.sh or use Homebrew:

    brew install --cask cursor
  2. AI Features: Familiarize yourself with:

    • Command+K to open the AI chat
    • Command+L to generate code in-line
    • Command+I to explain selected code
  3. Keyboard Shortcuts: Learn the essential shortcuts to boost productivity.

Node.js and npm Setup

Node.js is essential for JavaScript development and running many web applications:

  1. Install Node.js and npm: Use Homebrew for easy updates:

    brew install node
  2. Verify Installation:

    node -v
    npm -v
  3. Update npm (optional):

    npm install -g npm@latest

Git Setup

Git is crucial for version control and working with code repositories:

  1. Configure Git:

    git config --global user.name "Your Name"
    git config --global user.email "your.email@example.com"
  2. Basic Git Commands:

    • git init - Initialize a new Git repository
    • git clone [url] - Clone a repository
    • git add . - Stage all changes
    • git commit -m "Message" - Commit staged changes
    • git push - Push commits to remote repository
    • git pull - Pull changes from remote repository

Project Management

Organizing your projects effectively will save you time and frustration:

  1. Create a dedicated projects folder:

    mkdir ~/Projects
  2. Use consistent project structure:

    project-name/
    ├── README.md
    ├── index.html
    ├── css/
    │   └── style.css
    ├── js/
    │   └── script.js
    └── assets/
        ├── images/
        └── fonts/
  3. Document your projects: Create a README.md file for each project with:

    • Project description
    • Setup instructions
    • How to use the application
    • Technologies used

Browser Developer Tools

Modern browsers include powerful developer tools:

  1. Access Developer Tools:

    • Safari: Preferences > Advanced > Show Develop menu, then Develop > Show Web Inspector
    • Chrome: View > Developer > Developer Tools (or Cmd+Option+I)
    • Firefox: Tools > Web Developer > Toggle Tools (or Cmd+Option+I)
  2. Key Features to Learn:

    • Elements panel: Inspect and modify HTML/CSS
    • Console: View logs and run JavaScript
    • Network: Monitor network requests
    • Application: Inspect storage (localStorage, cookies)

Setting Up for Specific Project Types

Web Development

For basic web development, you already have everything you need with a code editor and browser. For more advanced projects:

  1. Install live-server for automatic browser refreshing:

    npm install -g live-server

    Use it by navigating to your project folder and running live-server

  2. Consider a CSS preprocessor like Sass:

    npm install -g sass

React Development

For React projects:

  1. Install Create React App:

    npm install -g create-react-app
  2. Create a new React project:

    npx create-react-app my-app
    cd my-app
    npm start

Next.js Development

For Next.js projects:

  1. Create a new Next.js project:

    npx create-next-app my-nextjs-app
    cd my-nextjs-app
    npm run dev

Troubleshooting Common Setup Issues

Permission Issues

If you encounter "permission denied" errors:

sudo chown -R $(whoami) /usr/local/lib/node_modules

Path Issues

If commands aren't found after installation:

  1. Check your PATH variable:

    echo $PATH
  2. Add to PATH in your profile file (~/.zshrc or ~/.bash_profile):

    export PATH="/usr/local/bin:$PATH"

Installation Failures

If Homebrew installations fail:

brew doctor

Follow the recommendations to fix issues.

Development Environment Best Practices

  1. Keep software updated:

    brew update && brew upgrade
  2. Use version managers for languages with multiple versions:

    • nvm for Node.js
    • pyenv for Python
    • rbenv for Ruby
  3. Back up configuration files:

    • Use Git to track your dotfiles
    • Consider a tool like Mackup
  4. Learn keyboard shortcuts for your most-used applications