Skip to content

Instantly share code, notes, and snippets.

@mrysav
Created June 13, 2019 14:37
Show Gist options
  • Select an option

  • Save mrysav/5f692f9a4a46de7323e646f2af100cdb to your computer and use it in GitHub Desktop.

Select an option

Save mrysav/5f692f9a4a46de7323e646f2af100cdb to your computer and use it in GitHub Desktop.
init_sys_v1.sh
#!/usr/bin/env bash
# Colors
GRN='\033[1;32m'
NC='\033[0m'
echo -e "${GRN}Installing prerequisites...${NC}"
echo "rbenv: https://github.com/rbenv/ruby-build/wiki#suggested-build-environment"
# debian
if [ -x "$(command -v apt-get)" ]; then
sudo apt-get install autoconf bison build-essential libssl-dev libyaml-dev libreadline6-dev zlib1g-dev libncurses5-dev libffi-dev libgdbm5 libgdbm-dev
# alinux, probably
elif [ -x "$(command -v yum)" ]; then
sudo yum install -y gcc-6 bzip2 openssl-devel libyaml-devel libffi-devel readline-devel zlib-devel gdbm-devel ncurses-devel
# osx or some weirdo using homebrew on linux (whyyyyy)
elif [ -x "$(command -v brew)" ]; then
echo "Note: skipping xcode-select --install; run it your own dang self."
# optional, but recommended:
brew install openssl libyaml libffi
# required for building Ruby <= 1.9.3-p0:
brew tap homebrew/core && brew install apple-gcc42
fi
git clone https://github.com/rbenv/rbenv.git "$HOME"/.rbenv
mkdir -p "$HOME/.rbenv/plugins"
git clone https://github.com/rkh/rbenv-update.git "$HOME/.rbenv/plugins/rbenv-update"
echo "pyenv: https://github.com/pyenv/pyenv/wiki#suggested-build-environment"
# debian
if [ -x "$(command -v apt-get)" ]; then
sudo apt-get install --no-install-recommends make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev
# alinux, probably
elif [ -x "$(command -v yum)" ]; then
sudo yum install -y gcc zlib-devel bzip2 bzip2-devel readline-devel sqlite sqlite-devel openssl-devel tk-devel libffi-devel
# osx or some weirdo using homebrew on linux (whyyyyy)
elif [ -x "$(command -v brew)" ]; then
echo "Note: skipping xcode-select --install; run it your own dang self."
# optional, but recommended:
brew install openssl readline sqlite3 xz zlib
fi
git clone https://github.com/pyenv/pyenv.git "$HOME"/.pyenv
mkdir -p "$HOME/.pyenv/plugins"
git clone git://github.com/pyenv/pyenv-update.git "$HOME"/.pyenv/plugins/pyenv-update
git clone https://github.com/nodenv/nodenv.git "$HOME"/.nodenv
mkdir -p "$HOME/.nodenv/plugins"
git clone https://github.com/nodenv/node-build.git "$HOME"/.nodenv/plugins/node-build
git clone https://github.com/nodenv/nodenv-package-rehash.git "$HOME"/.nodenv/plugins/nodenv-package-rehash
git clone https://github.com/nodenv/nodenv-update.git "$HOME"/.nodenv/plugins/nodenv-update
echo -e "${GRN}Copypasta this-a into your .bash_profile or whatever:${NC}"
cat << EOF
# ruby
export PATH="\$HOME/.rbenv/bin:\$PATH"
eval "\$(rbenv init -)"
# python
export PATH="\$HOME/.pyenv/bin:\$PATH"
eval "\$(pyenv init -)"
# node
export PATH="\$HOME/.nodenv/bin:\$PATH"
eval "\$(nodenv init -)"
EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment