LoginSignup
50
28

More than 5 years have passed since last update.

Xcode8環境下でrbenvにてrubyのコンパイルに失敗する

Posted at
$ rbenv install 2.3.1

Downloading ruby-2.3.1.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/2.3/ruby-2.3.1.tar.bz2
Installing ruby-2.3.1...

BUILD FAILED (OS X 10.11.6 using ruby-build 20160602)

Inspect or clean up the working tree at /var/folders/w1/_jhh90bj5lx0xg0hycdqvjs40000gn/T/ruby-build.20160918151039.20332
Results logged to /var/folders/w1/_jhh90bj5lx0xg0hycdqvjs40000gn/T/ruby-build.20160918151039.20332.log

Last 10 log lines:
  Referenced from: /private/var/folders/w1/_jhh90bj5lx0xg0hycdqvjs40000gn/T/ruby-build.20160918151039.20332/ruby-2.3.1/./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/w1/_jhh90bj5lx0xg0hycdqvjs40000gn/T/ruby-build.20160918151039.20332/ruby-2.3.1/./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

Mac OS X 10.12 用のが入っているのが原因なようなので、必要なツールをインストールする

$ xcode-select --install

xcode-select: note: install requested for command line developer tools

そうすると

$ rbenv install 2.3.1                                                                      
Downloading ruby-2.3.1.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/2.3/ruby-2.3.1.tar.bz2
Installing ruby-2.3.1...
Installed ruby-2.3.1 to /Users/xxxx/.rbenv/versions/2.3.1

と解決

50
28
3

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
50
28