Mavericks, RBENV, Your Ruby version is 2.0.0, but your Gemfile specified 2.1.1

后端 未结 2 881
轻奢々
轻奢々 2020-12-13 22:29

I\'ve read and tried the suggestions in several, other, questions, like mine (all with accepted answers) as well as a few more hours of Google searching, but nothing worked.

2条回答
  •  孤城傲影
    2020-12-13 22:48

    If you're having to use sudo to install gems, then something's likely wrong with your rbenv installation. I'm of the opinion that if you're on OS X and you have to run sudo to install gems or packages, you're doing it wrong (especially if you've got homebrew installed)! You've got two options —

    Option A: Alter your .zshrc to be a little more friendly with your $PATH and your rbenv settings. Note here that /usr/local/bin is just being prepended to $PATH, which itself is going to set to a proper default by your system (Mavericks). Make those two lines you posted look like this:

    export PATH="/usr/local/bin:$PATH"
    eval "$(rbenv init -)"
    

    Then ensure that you close any and all shells and open new ones to load the new settings. Then when you run echo $PATH it should look similar to...

    [home path]/.rbenv/shims:[home path]/.rbenv/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
    

    Option B: Since I'm more familiar with installing rbenv via git, you may try nuking your homebrew-installed rbenv installation by brew remove rbenv, and follow the directions specified on rbenv's github page (and don't forget to install ruby-build as well). This includes removing any rbenv-specific lines in your .zshrc and setting them to what rbenv recommends.

    You can always check the sanity of your rbenv installation by running type rbenv at a command prompt. If all is well, you should at least be getting back "rbenv is a function".

提交回复
热议问题