Skip to content

Instantly share code, notes, and snippets.

@nsticco
Last active July 7, 2023 22:21
#!/bin/bash
###############################################################################
# Customize the script by passing values to the named parameters below, e.g.
# ./bootstrap-mac-devops.sh --nodejs 12
nodejs=${nodejs:-16}
keygen=${keygen:-true}
java=${java:-11}
while [ $# -gt 0 ]; do
if [[ $1 == *"--"* ]]; then
param="${1/--/}"
declare $param="$2"
# echo $1 $2 # Optional to see the parameter:value result
fi
shift
done
###############################################################################
# Install Homebrew, if not installed
if test ! $(which brew); then
echo "Installing homebrew..."
CI=1 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
(echo; echo 'eval "$(/opt/homebrew/bin/brew shellenv)"') >> ~/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"
fi
echo "Installing general utilities..."
brew update
brew install python3 git vim nano
echo "Installing Node.js..."
brew install node@${nodejs}
echo 'export PATH="/usr/local/opt/node@${nodejs}/bin:$PATH"' >> ~/.bash_profile
echo "Installing Java ${java}..."
brew tap AdoptOpenJDK/openjdk
brew install adoptopenjdk${java}
echo "Installing Ansible..."
brew install ansible
echo "Installing AWS CLI v2..."
brew install awscli
echo "Installing kubectl..."
brew install kubectl
brew link --overwrite kubectl
echo "Installing the latest Helm..."
brew install helm
echo "Installing Terraform..."
brew tap hashicorp/tap
brew install hashicorp/tap/terraform
echo "Installing Terragrunt..."
brew install terragrunt
echo "Installing Packer..."
brew install packer
echo "Installing Vault..."
brew install vault
echo "Installing Postman..."
brew install --cask postman
echo "Installing Rancher Desktop..."
brew install --cask rancher
# Install Visual Studio Code using Homebrew, if not installed
if test ! $(which code); then
echo "Installing Visual Studio Code..."
brew install --cask visual-studio-code
fi
# Install Visual Studio Code Extensions
echo "Installing Visual Studio Code Extensions..."
code --install-extension daylerees.rainglow \
--install-extension secanis.jenkinsfile-support \
--install-extension ms-python.python \
--install-extension ms-vscode.cpptools \
--install-extension esbenp.prettier-vscode \
--install-extension bradgashler.htmltagwrap \
--install-extension dsznajder.es7-react-js-snippets \
--install-extension dunstontc.vscode-docker-syntax \
--install-extension formulahendry.code-runner \
--install-extension hashicorp.terraform \
--install-extension 4ops.terraform \
--install-extension eamodio.gitlens \
--install-extension vscode-icons-team.vscode-icons \
--install-extension zxh404.vscode-proto3 \
--install-extension ms-vscode.vs-keybindings \
--install-extension ms-vscode.cpptools \
--install-extension twxs.cmake \
--install-extension ms-vscode.cmake-tools \
--install-extension github.copilot \
--install-extension ms-azuretools.vscode-docker \
--install-extension dtsvet.vscode-wasm
if [ $keygen = true ] ; then
echo "Checking if ssh key already exists..."
if [ ! -f ~/.ssh/id_rsa ] ; then
echo "Generating a new SSH key..."
ssh-keygen -q -t rsa -b 4096 -N "" -C "$(whoami)@$(hostname)" -f ~/.ssh/id_rsa <<<y 2>&1 >/dev/null
else
echo "Key already exists"
fi
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment