Skip to content

Instantly share code, notes, and snippets.

@emgeee
Created February 15, 2026 01:19
Show Gist options
  • Select an option

  • Save emgeee/8adc80f5132dc0a58188dee5f513cea6 to your computer and use it in GitHub Desktop.

Select an option

Save emgeee/8adc80f5132dc0a58188dee5f513cea6 to your computer and use it in GitHub Desktop.
Dev Workspace bootstrap installer
#!/usr/bin/env bash
set -euo pipefail
# Bootstrap script for dev-workspace
# Run from a fresh macOS or Linux machine:
# bash <(curl -fsSL https://gist.githubusercontent.com/FIXME/FIXME/raw/install.sh)
REPO="usespeakeasy/dev-workspace"
REPO_DIR="dev-workspace"
# Colors
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
BOLD='\033[1m'
NC='\033[0m'
info() { echo -e "${BLUE}==>${NC} ${BOLD}$1${NC}"; }
pass() { echo -e " ${GREEN}✓${NC} $1"; }
fail() { echo -e " ${RED}✗${NC} $1" >&2; exit 1; }
detect_os() {
case "$OSTYPE" in
darwin*) echo "macos" ;;
linux*) echo "linux" ;;
*) echo "unknown" ;;
esac
}
command_exists() {
command -v "$1" &> /dev/null
}
install_homebrew() {
info "Installing Homebrew..."
NONINTERACTIVE=1 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# Add Homebrew to PATH for this session
if [[ "$(detect_os)" == "linux" ]]; then
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
# Add to shell profiles
local brew_line='eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"'
for rcfile in "$HOME/.bashrc" "$HOME/.zshrc" "$HOME/.profile"; do
if [[ -f "$rcfile" ]] && ! grep -q "linuxbrew" "$rcfile" 2>/dev/null; then
echo "$brew_line" >> "$rcfile"
fi
done
elif [[ "$(detect_os)" == "macos" ]]; then
if [[ -x /opt/homebrew/bin/brew ]]; then
eval "$(/opt/homebrew/bin/brew shellenv)"
elif [[ -x /usr/local/bin/brew ]]; then
eval "$(/usr/local/bin/brew shellenv)"
fi
fi
}
main() {
local os
os=$(detect_os)
echo ""
echo -e "${BOLD}Dev Workspace Bootstrap${NC}"
echo ""
if [[ "$os" == "unknown" ]]; then
fail "Unsupported operating system. macOS and Linux are supported."
fi
# Step 1: Homebrew
info "Checking Homebrew..."
if command_exists brew; then
pass "Homebrew already installed"
else
install_homebrew
if command_exists brew; then
pass "Homebrew installed"
else
fail "Homebrew installation failed"
fi
fi
# Step 2: Install gh and just
info "Installing GitHub CLI and just..."
for pkg in gh just; do
if brew list "$pkg" &>/dev/null; then
brew upgrade "$pkg" 2>/dev/null || true
else
brew install "$pkg"
fi
done
if command_exists gh && command_exists just; then
pass "gh and just installed"
else
fail "Failed to install gh and just via Homebrew"
fi
# Step 3: GitHub authentication
info "Checking GitHub authentication..."
if gh auth status &>/dev/null; then
pass "GitHub CLI authenticated"
else
echo ""
echo -e "${YELLOW}GitHub authentication required to clone the private repo.${NC}"
echo ""
if ! gh auth login; then
fail "GitHub authentication failed. Cannot clone private repo without auth."
fi
pass "GitHub CLI authenticated"
fi
# Step 4: Clone the repo
info "Cloning $REPO..."
if [[ -d "$REPO_DIR/.git" ]]; then
pass "$REPO_DIR already exists, skipping clone"
else
if ! gh repo clone "$REPO"; then
fail "Failed to clone $REPO. Check your GitHub access."
fi
pass "Repository cloned"
fi
# Step 5: Hand off to just setup
echo ""
info "Running just setup..."
echo ""
cd "$REPO_DIR"
just setup
}
main "$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment