Ruby 1.8.7 to 1.9.1 on OS X 10.6
I am currently learning Ruby using Ruby 1.8.7 (pre-installed on OS X 10.6) but understand the latest version is 1.9.1?
Is it a requirement for me to 'upgrade' this to get the most out of the language? What are the differences between 1.8.7 and 1.9.1?
If an upgrade is 开发者_如何学Pythonadvisable can anyone advise how I should go about upgrading my Ruby?
Currently the stable release is 1.9.2.
It's not mandatory to upgrade, although 1.9.2 offers better performance and some nifty features (e.g.: better Unicode support, Time and regex improvements, etc.).
Choosing to upgrade mostly depends on what you need to achieve, but I would suggest to install Ruby Version Manager, so that you can install all the versions you want and easily switch between them. You can find all the info at https://rvm.io and a nice guide here: http://ruby.about.com/od/rubyversionmanager/ss/Installing-Ruby-On-Snow-Leopard-With-Rvm.htm
There is nothing like a requirement but it is strongly encouraged by the community to use ruby 1.9.2.
The best way to give it a try is through RVM
RVM is cool. But probably later you will need another gnu software, not native in OS X. Therefore, i'm recommending to use macports
.
- go to www.macports.org
- download the installation dmg
- install it
- open an new Terminal windows (or source ~/.profile )
Enter the following
sudo port selfupdate
sudo port install ruby19
port search rb19-
pick what you want and install them with port install
command. (as above), for example
sudo port install rb19-rails
sudo port install rb19-rails_best_practices
sudo port install rb19-actionpack
and so on...
Note
- everything will compile, so need Installed Apple Developer, and will take a long time.
- you need to use /opt/local/bin/ruby and not /usr/bin/ruby
Everything will go into /opt/local
tree - so does not interfere with your standard system binaries - your system remain untouched.
精彩评论