Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save tranductam2802/036c1a00b467e1e9b6c9967d8cee46c7 to your computer and use it in GitHub Desktop.
Save tranductam2802/036c1a00b467e1e9b6c9967d8cee46c7 to your computer and use it in GitHub Desktop.
Install Ruby (2.5.1) on Rails (5.2.0) 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 the missing package'
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
echo ' # Install ruby on rails'
gem install rails -v 5.2.0
rbenv rehash
rails -v
echo ' # Setting Up A Database'
brew install sqlite3
echo ' # Successfully'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment