-
-
Save tranductam2802/723fae212b7f2aadf498a18a9ea8f06a to your computer and use it in GitHub Desktop.
Install Ruby (default 2.2) with Readline and latest OpenSSL (環境管理ツールのrbenvを作成する)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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