Last active
January 3, 2026 09:56
-
-
Save sounishnath003/5644a3aff4060bc6cda9353dccbcce0b to your computer and use it in GitHub Desktop.
To setup sounish dev setup
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| set -e | |
| echo "π Starting Dev Environment Setup..." | |
| # ---------------------------- | |
| # Detect OS | |
| # ---------------------------- | |
| OS="" | |
| if [[ "$OSTYPE" == "darwin"* ]]; then | |
| OS="macos" | |
| elif [[ -f /etc/debian_version ]]; then | |
| OS="linux" | |
| else | |
| echo "β Unsupported OS" | |
| exit 1 | |
| fi | |
| echo "π₯οΈ Detected OS: $OS" | |
| # ---------------------------- | |
| # Helpers | |
| # ---------------------------- | |
| command_exists() { | |
| command -v "$1" >/dev/null 2>&1 | |
| } | |
| append_if_missing() { | |
| local line="$1" | |
| local file="$2" | |
| grep -qxF "$line" "$file" 2>/dev/null || echo "$line" >> "$file" | |
| } | |
| ZSHRC="$HOME/.zshrc" | |
| # ---------------------------- | |
| # Package Managers | |
| # ---------------------------- | |
| if [[ "$OS" == "macos" ]]; then | |
| if ! command_exists brew; then | |
| echo "πΊ Installing Homebrew..." | |
| /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" | |
| fi | |
| PM_INSTALL="brew install" | |
| elif [[ "$OS" == "linux" ]]; then | |
| sudo apt update | |
| PM_INSTALL="sudo apt install -y" | |
| fi | |
| # ---------------------------- | |
| # Git | |
| # ---------------------------- | |
| if ! command_exists git; then | |
| echo "π¦ Installing Git..." | |
| $PM_INSTALL git | |
| else | |
| echo "β Git already installed" | |
| fi | |
| # ---------------------------- | |
| # Python | |
| # ---------------------------- | |
| if ! command_exists python3; then | |
| echo "π¦ Installing Python..." | |
| $PM_INSTALL python3 python3-pip | |
| else | |
| echo "β Python already installed" | |
| fi | |
| # ---------------------------- | |
| # Go | |
| # ---------------------------- | |
| if ! command_exists go; then | |
| echo "π¦ Installing Go..." | |
| if [[ "$OS" == "macos" ]]; then | |
| $PM_INSTALL go | |
| else | |
| $PM_INSTALL golang | |
| fi | |
| else | |
| echo "β Go already installed" | |
| fi | |
| append_if_missing 'export GOPATH=$HOME/go' "$ZSHRC" | |
| append_if_missing 'export PATH=$PATH:$GOPATH/bin' "$ZSHRC" | |
| # ---------------------------- | |
| # Java (OpenJDK) | |
| # ---------------------------- | |
| if ! command_exists java; then | |
| echo "π¦ Installing OpenJDK..." | |
| if [[ "$OS" == "macos" ]]; then | |
| $PM_INSTALL openjdk | |
| append_if_missing 'export PATH="/opt/homebrew/opt/openjdk/bin:$PATH"' "$ZSHRC" | |
| else | |
| $PM_INSTALL openjdk-17-jdk | |
| fi | |
| else | |
| echo "β Java already installed" | |
| fi | |
| # ---------------------------- | |
| # Node.js + npm (LTS) | |
| # ---------------------------- | |
| if ! command_exists node; then | |
| echo "π¦ Installing Node.js (LTS)..." | |
| if [[ "$OS" == "macos" ]]; then | |
| $PM_INSTALL node | |
| else | |
| curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash - | |
| sudo apt install -y nodejs | |
| fi | |
| else | |
| echo "β Node.js already installed" | |
| fi | |
| # ---------------------------- | |
| # Docker | |
| # ---------------------------- | |
| if ! command_exists docker; then | |
| echo "π¦ Installing Docker..." | |
| if [[ "$OS" == "macos" ]]; then | |
| $PM_INSTALL --cask docker | |
| else | |
| sudo apt install -y docker.io | |
| sudo systemctl enable docker | |
| sudo systemctl start docker | |
| sudo usermod -aG docker "$USER" | |
| echo "β οΈ Log out & log back in for Docker group changes" | |
| fi | |
| else | |
| echo "β Docker already installed" | |
| fi | |
| # ---------------------------- | |
| # Minikube | |
| # ---------------------------- | |
| if ! command_exists minikube; then | |
| echo "π¦ Installing Minikube..." | |
| if [[ "$OS" == "macos" ]]; then | |
| $PM_INSTALL minikube | |
| else | |
| curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64 | |
| sudo install minikube-linux-amd64 /usr/local/bin/minikube | |
| rm minikube-linux-amd64 | |
| fi | |
| else | |
| echo "β Minikube already installed" | |
| fi | |
| # ---------------------------- | |
| # Verification | |
| # ---------------------------- | |
| echo "" | |
| echo "π Installed Versions:" | |
| python3 --version || true | |
| go version || true | |
| java -version || true | |
| node --version || true | |
| npm --version || true | |
| docker --version || true | |
| minikube version || true | |
| git --version || true | |
| echo "" | |
| echo "π Dev environment setup complete!" | |
| echo "π Restart your terminal or run: source ~/.zshrc" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment