Skip to content

Instantly share code, notes, and snippets.

@tranductam2802
Forked from turadg/install-ruby-2.0.0.sh
Last active August 23, 2018 08:04
Show Gist options
  • Save tranductam2802/723fae212b7f2aadf498a18a9ea8f06a to your computer and use it in GitHub Desktop.
Save tranductam2802/723fae212b7f2aadf498a18a9ea8f06a to your computer and use it in GitHub Desktop.
Install Ruby (default 2.2) with Readline and latest OpenSSL (環境管理ツールのrbenvを作成する)
#!/usr/bin/env sh
echo '# Update the newest brew tool'
brew update
echo '# Upgrade any that were already installed'
brew upgrade rbenv ruby-build readline openssl
echo "# Install what's missing"
brew install rbenv ruby-build readline openssl
echo '# Set up rbenv in your shell'
rbenv init
echo '# Initial Ruby environment tool into OS shell'
cp ~/.bash_profile ~/.bash_profile.bak
echo '# Initial Ruby environment tool' >> ~/.bash_profile
echo 'eval "$(rbenv init -)"' >> ~/.bash_profile
source ~/.bash_profile
echo '# Verify that rbenv is properly set up using this rbenv-doctor script'
curl -fsSL https://github.com/rbenv/rbenv-installer/raw/master/bin/rbenv-doctor | bash
echo '# Build with Readline and OpenSSL'
env RUBY_CONFIGURE_OPTS=--with-openssl-dir=`brew --prefix openssl` CONFIGURE_OPTS=--with-readline-dir=`brew --prefix readline`
rbenv install 2.5.1
echo '# Active the build'
rbenv global 2.5.1
echo '$ which rbenv'
which rbenv
echo '$ which gem'
which gem
echo '$ gem which rubygems'
gem which rubygems
echo '# Test the SSL'
ruby -rnet/https -e "Net::HTTP.get URI('https://github.com')"
if [ $? -eq 0 ]
then
echo 'HTTPS working'
else
echo 'HTTPS not working! Repair it...'
echo '# If the above fails, follow this solution'
open http://railsapps.github.com/openssl-certificate-verify-failed.html
fi
echo '# Install ruby gem'
gem install bundler
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment