One Script to Rebuild Your Development Environment in 15 Minutes

Stop wasting hours setting up machines. A practical, idempotent approach to creating a single script that reproduces your dev environment quickly and reliably.

Written by: Arjun Malhotra

Open laptop on a desk showing a code editor and terminal
Image credit: Unsplash

Have you ever stared at a fresh machine for longer than you care to admit, hunting down the right Node version, remembering which VS Code extensions you swear by, and rediscovering that obscure CLI tool you once needed? Setting up a new workstation is the kind of chore that drains creative energy before you even start coding.

I used to treat setup as a “one-off” — install this, fiddle with that, copy dotfiles, curse, debug, repeat. Then I built a single reproducible script that does 95% of the work in about 15 minutes. It’s not magic; it’s just deliberate design: idempotent steps, clear order, and a few dependable tools. If you want to stop wasting time and feel more confident when switching machines or onboarding new teammates, this approach will change that small part of your life.

Why one script matters

A consistent dev environment does three things: removes friction, reduces bugs that only happen locally, and frees mental bandwidth for actual work. When your setup is ad hoc, you carry invisible debt — forgotten tools, mismatched versions, and undocumented tweaks. That’s how “works on my machine” becomes a real problem.

A single script makes setup repeatable. It’s also a living document of your preferences: package managers you trust, editors and extensions you use, and the way you manage runtimes. Treat the script like configuration rather than a sequence of random commands. That mindset shift — from “do this once” to “this is my environment as code” — changes how you maintain and share it.

Finally, a well-written script is idempotent: run it twice and nothing breaks. That saves you from fragile restore steps and lets you safely tweak things without fear.

What a good dev environment setup actually includes

There’s no one-size-fits-all list, but generally a solid dev environment script covers these layers in order:

You don’t install everything at once — install the most crucial items first, then add optional blocks that can be toggled. The script should detect the OS and run only the relevant sections. When the script is modular, you can reuse parts for servers, CI images, or teammate onboarding.

Main keyword reminder: dev environment setup appears naturally in the examples and instructions here so you can find it later.

How to actually start: a practical script blueprint

Below is a practical, idempotent structure you can adapt. Keep it in a Git repo (e.g., ~/dotfiles or github.com/you/machine-setup), and version it like any other project.

  1. Repo layout (simple)
  1. Principles to follow
  1. Example snippets

OS detection (bash):

#!/usr/bin/env bash
set -euo pipefail

OS=""
if [[ "$OSTYPE" == "darwin"* ]]; then
  OS="mac"
elif [[ -f /etc/debian_version ]]; then
  OS="debian"
else
  OS="linux"
fi
echo "Detected OS: $OS"

Idempotent install example (Homebrew):

install_homebrew() {
  if ! command -v brew >/dev/null 2>&1; then
    echo "Installing Homebrew..."
    /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
  else
    echo "Homebrew already installed, updating..."
    brew update
  fi
}

Linking dotfiles safely:

link_dotfile() {
  local src="$1" dst="$2"
  if [[ -e "$dst" && ! -L "$dst" ]]; then
    mv "$dst" "$dst".bak
    echo "Backed up $dst to $dst.bak"
  fi
  ln -sf "$src" "$dst"
  echo "Linked $src -> $dst"
}

Install runtimes via asdf (portable approach):

# install asdf if missing
if [[ ! -d "$HOME/.asdf" ]]; then
  git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.12.0
fi
# ensure asdf in PATH and then:
asdf plugin-add nodejs || true
asdf install nodejs 18.17.0
asdf global nodejs 18.17.0

These patterns let you add tools one at a time while keeping the whole script safe to rerun.

Quick wins and practical tips to keep this maintainable

Main keyword check: dev environment setup appears naturally three times here.

Mistakes I see people make (so you don’t have to)

Making this work with teams

If you’re building this for a team, put it in a central repo with a README and a short checklist for new joiners. Consider:

And remember: not every developer agrees on every tool. Use sensible defaults and make opt-in configuration easy.

Wrapping up

A reproducible dev environment setup turns an annoying chore into a predictable, low-friction step. Aim for idempotence, modularity, and clear documentation. Put your script under version control, keep secrets out, and run the setup on a test machine before trusting it. Do that once, and the next time you unbox a laptop or onboard a teammate, you’ll save hours and start being productive faster — and that tiny win compounds into a lot more calm days at the keyboard.