Skip to content

Instantly share code, notes, and snippets.

@jousby
Created August 9, 2021 04:22
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save jousby/2ab150ba190abf3cf7047f7f029e69d4 to your computer and use it in GitHub Desktop.
Save jousby/2ab150ba190abf3cf7047f7f029e69d4 to your computer and use it in GitHub Desktop.
A macOS shell and developer toolchain setup script updated for Big Sur (Aug 2021)
#!/bin/bash
#####################################################################
#
# A macOS dev env setup script updated for a Big Sur
# install (08/2021). There isn't anything macos specific in here
# though, i just haven't tested it elsewhere.
#
# I have a seperate script that setups a fresh macOS install with
# a useful set of software applicatiions that you might want to run
# before this one.
# Link to macos-software-bootstrap.sh:
# https://gist.github.com/jousby/18950c84b21341d48c5c1710065ef96b
#
# DISCLAIMER: This script hasn't been designed to be run more than once.
# If you have failed steps during the first run then you will need
# to manage retrying the failed parts on your own.
#
#####################################################################
echo ""
echo "Starting dev env setup..."
echo ""
#####################################################################
# Pimp zsh
#
# NOTE: To use the bullet-train theme with zsh you will need to
# change Terminal/iterm2 to use one of the powerline fonts installed
# with the first set of commands below. I use
# 'Source Code Pro for Powerline - Regular - 13'.
#####################################################################
# Install powerline fonts (needed by the oh-my-zsh bullet train theme)
git clone https://github.com/powerline/fonts.git /tmp/fonts
/tmp/fonts/install.sh
rm -rf /tmp/fonts
# Install bullet-train theme
mkdir -p ~/.zsh-custom/themes
curl -L -o ~/.zsh-custom/themes/bullet-train.zsh-theme https://raw.githubusercontent.com/caiogondim/bullet-train.zsh/master/bullet-train.zsh-theme
# Install oh my zsh
if [ ! -d "$HOME/.oh-my-zsh" ]; then
echo "Installing oh-my-zsh"
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
fi
Customise oh my zsh to use bullet train theme
sed -i.bak "s/ZSH_THEME=\(.*\)/ZSH_THEME=bullet-train/" ~/.zshrc
sed -i.bak2 "s/^# ZSH_CUSTOM=\(.*\)/ZSH_CUSTOM=~\/.zsh-custom/" ~/.zshrc
cat << EOT >> ~/.zshrc
# Configure the oh-my-zsh bullet-train theme
export BULLETTRAIN_PROMPT_ORDER=(
time
status
custom
# context
dir
screen
perl
ruby
virtualenv
nvm
aws
go
rust
elixir
git
hg
cmd_exec_time
)
export BULLETTRAIN_DIR_EXTENDED=2
EOT
#####################################################################
# Install the language toolchain version managers
#####################################################################
echo ""
echo "Install sdkman..."
echo ""
# Install Sdkman (manage jvm related build tools)
if [ ! -f ~/.sdkman/bin/sdkman-init.sh ]; then
echo "Installing Sdkman"
curl -s "https://get.sdkman.io" | bash
source ~/.sdkman/bin/sdkman-init.sh
sdk install java
sdk install gradle
sdk install maven
sdk install sbt
sdk install visualvm
fi
echo ""
echo "Install nvm..."
echo ""
# Install Node Version Manager
if [ ! -f ~/.nvm/nvm.sh ]; then
echo "Installing Node Version Manager"
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.38.0/install.sh | bash
cat <<-"EOT" >> ~/.zshrc
# Load nvm
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
EOT
source ~/.nvm/nvm.sh
nvm install node
fi
echo ""
echo "Set default python virtualenv..."
echo ""
# Set a default Python Virtualenv (assumes virtualenv was installed prior)
virtualenv ~/.virtualenvs/default
# ( I haven't need to run any ruby for a while, leaving this commented out)
# # Install Ruby Version Manager
# if [ ! -f ~/.rvm/scripts/rvm ]; then
# echo "Installing RVM"
# curl -L -o rvm-installer https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer
# chmod +x ./rvm-installer
# ./rvm-installer
# rm rvm-installer
#
# source ~/.zshrc
# rvm install ruby --latest --default
# fi
#####################################################################
# Get ready for git development (assumes git is already installed)
#####################################################################
echo ""
echo "Creating an SSH key..."
echo ""
ssh-keygen -t rsa
echo ""
echo "Setting git identity..."
echo ""
git config --global user.name "<your name here>"
git config --global user.email <your@email.here>
#####################################################################
# Install some of the basic vscode extensions (assumes vscode
# is already installed)
#####################################################################
echo ""
echo "Installing vscode extensions..."
echo ""
code --install-extension dbaeumer.vscode-eslint
code --install-extension esbenp.prettier-vscode
code --install-extension EditorConfig.EditorConfig
code --install-extension golang.go
code --install-extension vscodevim.vim
#####################################################################
# Install the AWS CLI v2 (will trigger pwd request)
#####################################################################
echo ""
echo "Installing aws cli v2..."
echo ""
curl "https://awscli.amazonaws.com/AWSCLIV2-2.0.30.pkg" -o "AWSCLIV2.pkg"
sudo installer -pkg AWSCLIV2.pkg -target /
#####################################################################
# Done
#####################################################################
echo ""
echo ""
echo "****** Dev env setup finished! ******"
echo ""
echo " NOTE: You should check the output for failed steps."
echo ""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment