Setup ruby env:
1. install RVM(RUBY version manage)
curl -L https://get.rvm.io | bash -s stable
/Users/yaya.feng/.rvm/scripts/rvm (the installation of rvm directory) run command on terminal
rvm -v view installation of rvm is it correct.
restart terminal;
rvm
rvm list known install ruby, display the version of ruby
2. Update the environment for RVM:
source ~/.rvm/scripts/rvm(/Users/yaya.feng/.rvm/scripts/rvm )
3. Now install the latest version of Ruby:
rvm install 2.2.4
4. To set ruby 2.2.4 as the default one, type:
rvm --default use 2.2.4(version)
question: config env path after installing ruby-----------? (i guess auto config path , wen can check it by env command on terminal)
we can install multiple version of ruby on mac, and we can set default ruby version for using.
remove the version of ruby :
sudo rvm remove 2.3.0 remove ruby version
Run the first ruby program——hello world
- write “hello world “on sublime text editor and then save it as filename.rb file on desktop
- run “ruby ./helloWorld.rb” file on terminal, and then print content on terminal.
env path:
rvm_bin_path=/Users/yaya.feng/.rvm/bin
rvm_path=/Users/yaya.feng/.rvm
rvm_prefix=/Users/yaya.feng
PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/yaya.feng/.rvm/bin:/Users/yaya.feng/.rvm/bin
rvm_version=1.27.0 (latest)
use env command view all env path list;
Attached the reference link
http://www.cnblogs.com/daguo/p/4097263.html ;
http://www.runoob.com/ruby/ruby-environment-variables.html ;
https://en.wikibooks.org/wiki/Ruby_Programming/Hello_world ;
http://guides.ruby-china.org/getting_started.html ; ruby on rails(web framework)
http://www.techbar.me/setting-up-a-ruby-development-environment-on-mac-os/ ;
http://code.tutsplus.com/tutorials/how-to-install-ruby-on-a-mac--net-21664