Ruby version not in ruby-build list for rbenv

后端 未结 5 1617
南方客
南方客 2021-01-15 15:56

I\'m using Rails 4.2 and wanted to update my Ruby version as well with rbenv.

I used Homebrew to install ruby-build and no matter how many times I try to update via

相关标签:
5条回答
  • 2021-01-15 16:28

    The recommended installation from (https://github.com/sstephenson/ruby-build) states that you should install ruby-build as an rbenv plug-in.

    • I uninstalled ruby-build via Homebrew (brew uninstall ruby-build)
    • Navigated to ruby-build on my local machine and deleted it
    • git clone https://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build

    Now, when I run rbenv install --list, I see Ruby 2.1.3. A quick installation of: rbenv install 2.1.3 and I am now free to use 2.1.3 where I like. This also worked for my teammate.

    0 讨论(0)
  • 2021-01-15 16:34

    Usually, follow these steps to install a new Ruby version with rbenv:

    $ brew update               
    $ brew upgrade ruby-build
    $ brew upgrade rbenv
    

    Check which versions are available after updating:

    $ ruby-build --definitions
    

    Install a specific version (for example 2.1.3) with:

    $ rbenv install 2.1.3
    

    Or if you are interested into improved support for UTF8 characters in the irb console:

    $ RUBY_CONFIGURE_OPTS=--with-readline-dir=`brew --prefix readline` rbenv install 2.1.3
    

    After these steps I usually set the newest version as my global default:

    $ rbenv global 2.1.3
    
    0 讨论(0)
  • 2021-01-15 16:45

    You need to update ruby build. After update you can install all current suported versions.

    If you using rbenv installed via git use

    cd "$(rbenv root)"/plugins/ruby-build && git pull

    Or via home brew

    $ brew upgrade ruby-build
    $ brew upgrade rbenv
    
    0 讨论(0)
  • 2021-01-15 16:49

    Please update by brew upgrade ruby-build and then you should see 2.1.3 in rbenv install --list

    0 讨论(0)
  • 2021-01-15 16:54

    If you installed rbenv and ruby-build with homebrew and when you do echo $(rbenv root), you get /usr/local/var/rbenv instead of /Users/<username>/.rbenv, here is how to fix the issue.


    When you install rbenv with homebrew, homebrew says:

    To use Homebrew's directories rather than ~/.rbenv add to your profile:
    export RBENV_ROOT=/usr/local/var/rbenv
    

    Don't do that. Remove that line from your profile. Make sure you refresh your terminal after.

    Then remove any signs of rbenv in the /usr/local/var directory:

    sudo rm -r /usr/local/var/rbenv
    

    Now when I do echo $(rbenv root) I get /Users/<username>/.rbenv instead of /usr/local/var/rbenv.

    That fixed it for me.

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