Skip to content

Instantly share code, notes, and snippets.

@dukejones
Created October 2, 2019 02:29
Show Gist options
  • Save dukejones/7c94d613c321f967fb97bbc0a03ac612 to your computer and use it in GitHub Desktop.
Save dukejones/7c94d613c321f967fb97bbc0a03ac612 to your computer and use it in GitHub Desktop.
Install binary language interpreter version manager asdf on mac with no assumption. Script tries to be as idempotent as possible.
echo "Be sure to uninstall rvm, rbenv, nvm, and any other version managers ... they will probably interfere with asdf's magic."
echo -e "\033[1;32mBeginning major install process... 🐋🚀 \033[0m"
command -v brew >/dev/null 2>&1 || /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
echo "Installing GPG Encryption"
brew list gpg >/dev/null || brew install gpg
echo "Installing asdf tool!"
brew list asdf >/dev/null || brew install asdf
if [[ -f ~/.bash_profile ]]; then
grep asdf ~/.bash_profile >/dev/null || printf "\n. /usr/local/opt/asdf/asdf.sh\n. /usr/local/opt/asdf/etc/bash_completion.d/asdf.bash\n" >> ~/.bash_profile
. ~/.bash_profile
fi
if [[ -f ~/.zshrc ]]; then
grep asdf ~/.zshrc >/dev/null && printf "\n. /usr/local/opt/asdf/asdf.sh\n" >> ~/.zshrc
. ~/.zshrc
fi
which node | grep "/usr/local/bin/node" >/dev/null && echo -e "\033[0;31mYour path is resolving to /usr/local/node when it should be using asdf. You will need to fix it so ~/.asdf/shims appears in your path before /usr/local/bin \033[0m"
echo "Installing Ruby!"
asdf plugin-list | grep ruby >/dev/null 2>&1 || asdf plugin-add ruby
asdf list ruby | grep 2.6.3 >/dev/null 2>&1 || asdf install ruby 2.6.3
asdf global ruby 2.6.3
echo "Installing NodeJS!"
asdf plugin-list | grep nodejs >/dev/null 2>&1 || asdf plugin-add nodejs
asdf list nodejs | grep 12.11.1 >/dev/null 2>&1 || asdf install nodejs 12.11.1
asdf global nodejs 12.11.1
gpg -k | grep "Gibson Fahnestock" >/dev/null || bash ~/.asdf/plugins/nodejs/bin/import-release-team-keyring
command -v yarn >/dev/null 2>&1 || npm install -g yarn
echo "Reshimming asdf."
asdf reshim
echo -e "\033[1;32mDone. Thank you for playing. Enjoy responsibly. 💚\033[0m"
echo -e "It is strongly recommended to open a new Terminal tab/window now to avoid hard-to-debug issues."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment