Upgrading Ruby on Mac OS X

后端 未结 5 1385
死守一世寂寞
死守一世寂寞 2021-02-19 00:32

I am reading the book Programming Ruby and am looking to upgrade the version of Ruby on my computer. I run Mac OS X Snow Leopard and doing ruby -v in the command line shows I am

相关标签:
5条回答
  • 2021-02-19 00:44

    As mentioned in hvgotcodes answer, RVM seems to be a great way of handling this.

    I recently started learning Ruby (and Rails) myself, and this[1] tutorial has a great section on using RVM. I'd highly recommend you give it a go, it's especially handy so that you can follow different tutorials on different versions of Ruby if you wish.

    [1] http://railstutorial.org/book#sec:rubygems

    0 讨论(0)
  • 2021-02-19 00:47

    You have to use ruby19 to run ruby if you installed it that way. You can also use irb19, and ri19.

    0 讨论(0)
  • 2021-02-19 00:53

    As @Andrew Grimm eluded, the problem you are having is likely due to a problem in your $PATH variable. Since macports typically installs stuff in /opt, modifying your $PATH variable to:

    $ export PATH=/opt/local/bin:$PATH
    

    Will most likely help. However, I would urge you to look into RVM as @hvgotcodes recommends.

    0 讨论(0)
  • 2021-02-19 01:02

    The tool "rvm" is pretty good. It stands for Ruby Verson Manager I think, and the developer is good at support in the irc channels. You can install multiple versions of ruby along side each other pick the ones you want to use.

    http://rvm.io

    0 讨论(0)
  • 2021-02-19 01:03

    I updated the link to RVM in one of the answers, but also a quick poll of some friends doing Ruby dev currently revealed a preference for rbenv as a ruby environment manager: http://github.com/sstephenson/rbenv/

    0 讨论(0)
提交回复
热议问题