How to get Ruby / Homebrew / RVM to work on Yosemite?

前端 未结 11 1757
自闭症患者
自闭症患者 2020-11-30 19:32

After installing Yosemite, I was unable to run brew or ruby.

I was getting this error on brew update:

/usr/local/bin/brew: /usr/local/Library/brew.r         


        
相关标签:
11条回答
  • 2020-11-30 19:52

    Editing the script means brew update won't work; there are local edits to tracked files which causes the git pull to fail.

    I did this, which I suspect is cleaner:

    cd /usr/local/Library
    git pull -q origin refs/heads/master:refs/remotes/origin/master
    

    There are no complaints from brew doctor.

    0 讨论(0)
  • 2020-11-30 19:52

    I had problems trying to install Ruby using package managers. In fairness to these programs, I admit to having little experience with them and did not make the effort to dig deeper as most of the other responders did. I'm lazy and prefer to use a binary installer available for most opsys choices and many packages. Unfortunately, Ruby doesn't seem to supply one.

    I found ruby-build easy to install (stand alone - not the plugin), and it built Ruby from sources without error and placed it where I wanted it.

    Bingo - easy:) This looks like a good alternative for those of us of the package manager challenged persuasion.

    Charlie

    0 讨论(0)
  • 2020-11-30 19:53

    I fixed this as follows:

    1. sudo chown -R $(whoami):admin /usr/local
    2. cd $(brew --prefix) && git fetch origin && git reset --hard origin/master
    0 讨论(0)
  • 2020-11-30 19:58

    I updated to Yosemite and later found out brew was broken.

    /usr/local/bin/brew: /usr/local/Library/brew.rb: 
    /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby: bad interpreter: No such file or directory /usr/local/bin/brew: line 23: /usr/local/Library/brew.rb: Undefined error: 0
    

    If you haven't made any changes to brew yet, here is what I recommend. Otherwise read further below.

    1. cd /System/Library/Frameworks/Ruby.framework/Versions/
    2. sudo ln -s Current 1.8
    3. brew update
    4. sudo unlink 1.8

    Already made changes to brew files and stuck in a git mess?

    I tried to edit /usr/local/Library/brew.rb but the local change to my git repo was preventing brew update from pulling down updates. I tried some other solutions mentioned on this page and from other sites and I ended up with a git mess and all I wanted to do was undo everything I had done to brew.

    I committed my change but it made things worse. Eventually I had to undo my commits and git reset --hard HEAD~1 until I was at the right commit-ish. I had a mess of unversioned files too (I changed files permissions in /usr/Local) so I did a git clean -f -d which removed all unversioned files and directories and got me back to where I started before I made any changes.

    0 讨论(0)
  • 2020-11-30 20:03

    Like the one before said: 1) Change to current 2) install xcode 6

    If you now have further problems with brew and ruby this should help: Somehow brew needs ruby on version 1.8, so create the folder:

    sudo mkdir -p /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin
    

    and make a symlink:

    sudo ln -s /usr/bin/ruby /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
    
    0 讨论(0)
提交回复
热议问题