How to Set Up a Local Development Environment

12 min read Developer Guides

Table of Contents

A well-configured local development environment is the foundation of productive software development. Whether you are building websites, APIs, mobile apps, or desktop software, having the right tools installed and properly configured saves you countless hours of frustration. This guide walks you through setting up a complete development environment from scratch, covering everything from choosing an operating system to configuring Docker containers.

Choosing Your Operating System

Your operating system shapes your entire development experience. Here is how the three main options compare in 2026:

Windows

Windows is the most common desktop OS and has become increasingly developer-friendly. With WSL 2 (Windows Subsystem for Linux), you can run a full Linux distribution alongside Windows, giving you access to Linux command-line tools without dual-booting. Windows is an excellent choice for .NET development, game development with Unity or Unreal Engine, and general web development.

macOS

macOS is popular among web developers and is required for iOS and macOS app development. It provides a Unix-based terminal out of the box, and tools like Homebrew make installing development software straightforward. Apple Silicon Macs (M-series chips) offer exceptional performance for development workloads.

Linux

Linux distributions like Ubuntu, Fedora, and Arch Linux are a natural fit for server-side development since most production servers run Linux. You get direct access to all the same tools your deployment environment uses. Ubuntu is the most beginner-friendly distribution for developers new to Linux.

There is no universally "best" choice. Use the OS you are most comfortable with. Thanks to tools like WSL, Docker, and cross-platform editors, the differences matter less than they used to.

Installing a Code Editor

Your code editor is where you spend most of your development time, so choosing the right one matters.

Visual Studio Code

VS Code is the most popular code editor among developers in 2026. It is free, open-source, lightweight, and extensible with thousands of extensions. It supports virtually every programming language through extensions and has built-in Git integration, an integrated terminal, and IntelliSense code completion. Download it from code.visualstudio.com.

Other Options

  • JetBrains IDEs (WebStorm, PyCharm, IntelliJ IDEA) – Full-featured IDEs with excellent refactoring tools and framework support. Paid licenses but free for students and open-source projects.
  • Sublime Text – A fast, minimal editor for developers who prefer simplicity.
  • Neovim – A modernized terminal-based editor for developers who prefer keyboard-driven workflows. Steep learning curve but incredibly efficient once mastered.
  • Cursor – An AI-first code editor built on VS Code that integrates advanced AI assistance directly into the editing experience.

Setting Up Your Terminal

A good terminal setup is essential for running commands, managing packages, and using version control.

Windows

Windows Terminal is pre-installed on Windows 11 and available from the Microsoft Store for Windows 10. It supports tabs, split panes, custom themes, and multiple shell profiles (PowerShell, Command Prompt, WSL, Git Bash). For the best experience on Windows, install WSL 2 to get a full Linux shell:

wsl --install

This command installs Ubuntu by default. After installation, you can access a full Linux terminal from within Windows Terminal.

macOS

The built-in Terminal app works well, but many developers prefer iTerm2, which offers split panes, search, autocomplete, and extensive customization. Install it from iterm2.com.

Shell Customization

Consider installing Oh My Zsh (for Zsh, which is the default shell on macOS and most Linux distributions) to add themes, plugins, and convenient aliases:

sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

Popular plugins include git (Git aliases and shortcuts), zsh-autosuggestions (suggests commands based on your history), and zsh-syntax-highlighting (colors commands as you type them).

Installing Language Runtimes

Install the programming languages and runtimes you will be working with. Here are the most common ones for web development:

Node.js

Node.js is essential for modern web development. Download the LTS version from nodejs.org, or use a version manager for flexibility:

  • Windows: Use nvm-windows (github.com/coreybutler/nvm-windows)
  • macOS/Linux: Use nvm (github.com/nvm-sh/nvm)
# Install and use a specific Node.js version
nvm install 22
nvm use 22

# Verify
node -v
npm -v

Python

Python is used for web development (Django, Flask, FastAPI), data science, scripting, and automation. Download from python.org or use a version manager:

  • Windows: Use pyenv-win
  • macOS/Linux: Use pyenv
# Verify installation
python --version
pip --version

Always use virtual environments to isolate project dependencies:

python -m venv venv
source venv/bin/activate  # Linux/macOS
venv\Scripts\activate     # Windows

PHP

PHP powers a huge portion of the web, including WordPress and Laravel. The easiest way to set up PHP on your local machine depends on your OS:

  • Windows: Use Laragon or XAMPP for a bundled Apache/PHP/MySQL setup, or install PHP standalone via scoop install php.
  • macOS: Use Homebrew: brew install php
  • Linux: sudo apt install php php-cli php-mbstring php-xml

For Laravel development, install Composer (the PHP package manager) from getcomposer.org.

Package Managers

Package managers simplify installing and updating software. Beyond language-specific managers (npm, pip, Composer), consider system-level package managers:

  • Windows: winget (built into Windows 11) or Chocolatey or Scoop
  • macOS: Homebrew (brew install <package>)
  • Linux: Your distribution's built-in manager (apt, dnf, pacman)

System-level package managers let you install developer tools like Git, Docker, databases, and CLI utilities with a single command.

Setting Up Version Control with Git

Git is non-negotiable for modern software development. Install it using your system package manager or download from git-scm.com.

After installation, configure your identity:

git config --global user.name "Your Name"
git config --global user.email "you@example.com"
git config --global init.defaultBranch main

SSH Keys for GitHub

Set up SSH authentication so you do not have to enter your username and password every time you push or pull:

# Generate an SSH key
ssh-keygen -t ed25519 -C "you@example.com"

# Start the SSH agent
eval "$(ssh-agent -s)"

# Add your key
ssh-add ~/.ssh/id_ed25519

Copy the public key (~/.ssh/id_ed25519.pub) and add it to your GitHub account under Settings > SSH and GPG keys.

Database Setup

Most applications need a database. Here are common options and how to install them locally:

MySQL / MariaDB

Download the MySQL Community Server from dev.mysql.com or install via a package manager. On macOS: brew install mysql. On Ubuntu: sudo apt install mysql-server. MariaDB is a drop-in replacement that many developers prefer.

PostgreSQL

PostgreSQL is a powerful open-source relational database favored for its reliability and feature set. Download from postgresql.org or install via package manager. On macOS: brew install postgresql@16.

SQLite

SQLite is a lightweight, file-based database that requires no server. It is built into Python and is perfect for development and small applications. No installation needed in most cases.

MongoDB

MongoDB is a document-based NoSQL database popular with JavaScript developers. Download the Community Edition from mongodb.com or use Docker (covered below).

Database GUI Tools

Managing databases through the command line works, but GUI tools make it easier:

  • DBeaver – Free, open-source, supports virtually every database.
  • TablePlus – A sleek, modern GUI for macOS, Windows, and Linux.
  • pgAdmin – The standard tool for PostgreSQL administration.

Docker Basics

Docker lets you run applications in isolated containers, ensuring consistent environments across development, testing, and production. Instead of installing databases, caches, and services directly on your machine, you can run them in containers that are easy to start, stop, and delete.

Installing Docker

Download Docker Desktop from docker.com. It is available for Windows, macOS, and Linux. On Windows, Docker Desktop uses WSL 2 as its backend, so make sure WSL 2 is installed first.

After installation, verify Docker is working:

docker --version
docker run hello-world

Common Docker Commands

# Run a PostgreSQL container
docker run --name my-postgres -e POSTGRES_PASSWORD=secret -p 5432:5432 -d postgres:16

# Run a Redis container
docker run --name my-redis -p 6379:6379 -d redis:7

# List running containers
docker ps

# Stop a container
docker stop my-postgres

# Remove a container
docker rm my-postgres

Docker Compose

For projects that need multiple services (a web server, a database, and a cache, for example), Docker Compose lets you define everything in a single docker-compose.yml file:

services:
  db:
    image: postgres:16
    environment:
      POSTGRES_DB: myapp
      POSTGRES_USER: user
      POSTGRES_PASSWORD: secret
    ports:
      - "5432:5432"
  redis:
    image: redis:7
    ports:
      - "6379:6379"

Start all services with a single command:

docker compose up -d

Environment Variables

Environment variables store sensitive configuration like API keys, database credentials, and secret tokens outside of your source code. Never hardcode secrets in your files.

Using .env Files

Most frameworks support .env files. Create a .env file in your project root:

DATABASE_URL=postgresql://user:secret@localhost:5432/myapp
API_KEY=your_api_key_here
NODE_ENV=development

Load these variables in your application using libraries like dotenv (Node.js), python-dotenv (Python), or the built-in env support in frameworks like Laravel and Next.js.

Critical: Always add .env to your .gitignore file. Create a .env.example file that lists the required variables without actual values, so other developers know what to configure.

Putting It All Together

Here is a checklist for a complete local development environment:

  1. Operating system – Updated to the latest version with developer tools enabled.
  2. Code editor – VS Code (or your preferred editor) with relevant extensions installed.
  3. Terminal – Windows Terminal with WSL 2, iTerm2, or your Linux terminal of choice.
  4. Git – Installed and configured with SSH keys for GitHub.
  5. Language runtimes – Node.js, Python, PHP, or whatever languages your projects require, ideally managed with version managers.
  6. Package managers – npm, pip, Composer, plus a system-level manager like Homebrew or winget.
  7. Databases – Installed locally or running in Docker containers.
  8. Docker – Installed for containerized services and consistent environments.
  9. Environment variables – Managed via .env files, excluded from version control.

Tips for Maintaining Your Environment

  • Keep tools updated – Regularly update your editor, runtimes, and packages to get security patches and new features.
  • Document your setup – Maintain a personal setup script or checklist so you can recreate your environment quickly on a new machine.
  • Use version managers – Tools like nvm and pyenv let you switch language versions per project, preventing conflicts.
  • Back up your configuration – Store your VS Code settings, shell configuration, and dotfiles in a Git repository so they are never lost.
  • Learn your tools deeply – Spend time learning keyboard shortcuts, CLI commands, and configuration options. The investment pays off enormously over time.

Conclusion

Setting up a local development environment takes some time upfront, but it is an investment that pays dividends throughout your entire career. A properly configured environment eliminates friction, reduces errors, and lets you focus on what matters most: writing great code. Start with the essentials listed in this guide, and gradually add tools and customizations as your needs evolve. The best development environment is one that works seamlessly for your specific workflow.

Related Articles