Skip to content

Instantly share code, notes, and snippets.

@saleehk
Created June 19, 2026 12:05
Show Gist options
  • Select an option

  • Save saleehk/4d8d928598cc00603765c7be47396052 to your computer and use it in GitHub Desktop.

Select an option

Save saleehk/4d8d928598cc00603765c7be47396052 to your computer and use it in GitHub Desktop.
server-setup.sh
#!/usr/bin/env bash
# -----------------------------------------------------------------------------
# Bootstrap Development Environment
#
# This script:
# 1. Installs Zsh if it is not already installed
# 2. Installs Oh My Zsh
# 3. Installs NVM (Node Version Manager)
# 4. Installs the latest LTS version of Node.js using NVM
#
# Supported platforms:
# - macOS
# - Ubuntu/Debian Linux
#
# Usage:
# curl -fsSL <gist-url> | bash
# -----------------------------------------------------------------------------
set -e
echo "Checking for Zsh..."
if ! command -v zsh >/dev/null 2>&1; then
echo "Zsh not found. Installing..."
if [[ "$OSTYPE" == "darwin"* ]]; then
brew install zsh
else
sudo apt update
sudo apt install -y zsh
fi
else
echo "Zsh is already installed."
fi
echo "Installing Oh My Zsh..."
if [ ! -d "$HOME/.oh-my-zsh" ]; then
RUNZSH=no CHSH=no sh -c \
"$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
else
echo "Oh My Zsh is already installed."
fi
echo "Installing NVM..."
export NVM_DIR="$HOME/.nvm"
if [ ! -d "$NVM_DIR" ]; then
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/master/install.sh | bash
else
echo "NVM is already installed."
fi
# Load NVM into current shell session
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
echo "Installing latest LTS version of Node.js..."
nvm install --lts
nvm use --lts
nvm alias default lts/*
echo "Setup completed successfully."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment