Reputation: 32721
I run brew update
and brew upgrade rbenv ruby-build
. FYI: I updated xcode to version 8.1 yesterday.
I checked available versions, rbenv install -l
.
Then I tried to install ruby2.2.5 by rbenv install 2.2.5
, then I get the following errors.
I tried 2.3.1 but I got the same errors. How can I fix the problem?
Downloading ruby-2.2.5.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/2.2/ruby-2.2.5.tar.bz2
Installing ruby-2.2.5...
BUILD FAILED (OS X 10.11.6 using ruby-build 20160602)
Inspect or clean up the working tree at /var/folders/2p/49l6q0gs6qzgtxbg4h1st_5h0000gq/T/ruby-build.20161106122840.51330
Results logged to /var/folders/2p/49l6q0gs6qzgtxbg4h1st_5h0000gq/T/ruby-build.20161106122840.51330.log
Last 10 log lines:
Referenced from: /private/var/folders/2p/49l6q0gs6qzgtxbg4h1st_5h0000gq/T/ruby-build.20161106122840.51330/ruby-2.2.5/./miniruby (which was built for Mac OS X 10.12)
Expected in: /usr/lib/libSystem.B.dylib
dyld: Symbol not found: _clock_gettime
Referenced from: /private/var/folders/2p/49l6q0gs6qzgtxbg4h1st_5h0000gq/T/ruby-build.20161106122840.51330/ruby-2.2.5/./miniruby (which was built for Mac OS X 10.12)
Expected in: /usr/lib/libSystem.B.dylib
make: *** [encdb.h] Trace/BPT trap: 5
make: *** Waiting for unfinished jobs....
make: *** [.rbconfig.time] Trace/BPT trap: 5
Upvotes: 1
Views: 6928
Reputation: 495
It's a really old question. However, the correct approach I believe is to upgrade ruby-build
. It is available as a plugin for rbenv that provides the rbenv install command.
so to fix the issue follow this approach: https://github.com/rbenv/ruby-build#upgrading
# Via Homebrew
$ brew update && brew upgrade ruby-build
Upvotes: 0
Reputation: 974
First, I've uninstalled all:
brew uninstall rbenv ruby-build
and because of an old sticky ruby-build installation, I've forced like this:
brew uninstall --force ruby-build
I can see an old invocation for rbenv when I type ruby -v
. So I remove all rbenv references from $HOME/.bash_profile
and then reload it with:
source $HOME/.bash_profile
Now I only see my old default MacOs ruby version:
ruby -v # ruby 2.0.0p481 (2014-05-08 revision 45883)
which ruby # /usr/bin/ruby
¡Good! Now it's time to install them again and then list available Ruby versions:
brew install rbenv
rbenv install -l
I now can see more Ruby options to install...
2.2.4, 2.2.5, 2.2.6, 2.2.7, 2.2.8, 2.2.9, 2.3.0, 2.3.1, 2.3.2, 2.3.3, 2.3.4, 2.3.5, 2.3.6, 2.4.0, 2.4.1, 2.4.2, 2.4.3, 2.5.0
I will choose one of them and make it global:
rbenv install 2.5.0
rbenv global 2.5.0
I case you don't have already the $HOME/.bash_profile
rbenv config line, run:
rbenv init
... and add the resulting line to your $HOME/.bash_profile
.
Upvotes: 2
Reputation: 32721
I tried to upgrade rbenv.
brew upgrade rbenv
Then I got a warning.
Warning: You have Xcode 8 installed without the CLT;
this causes certain builds to fail on OS X El Capitan (10.11).
Please install the CLT via:
sudo xcode-select --install
Error: rbenv 1.0.0 already installed
So I installed xcode-select
.
sudo xcode-select --install
Then I tried to upgrade rbenv but rbenv 1.0.0 was already installed.
brew upgrade rbenv
Error: rbenv 1.0.0 already installed
So I tried to install 2.3.1 and 2.2.5
rbenv install 2.3.1
...
rbenv install 2.2.5
And it was a success.
➜ ~ rbenv versions
system
1.9.3-p327
* 2.2.2 (set by /Users/sokada/.rbenv/version)
2.2.5
2.3.1
I also need to install bundle since I came to this problem from using bundle.
gem install bundler -v 1.13.6 // newest as of this writing
bundler -v
bundler install // finally I could use it.
Upvotes: 0