読者です 読者をやめる 読者になる 読者になる

Ruby on Rails と歩む我が人生

Railsプログラマを目指す漢のRailsとの歩みの記録

MacでrbenvでRuby2.x.xでインストールでBUILD FAILDでででで!!

Ruby

はじめに

Rubyのバージョンを2.0から2.3にあげようとしたらエラーが出てできなかった悲しい話です。

対処方法

出てきたエラー

toshiyuki@MacBook-Air [045843秒] [~/dotfiles] [master]
-> % rbenv install 2.3.0
Downloading ruby-2.3.0.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/2.3/ruby-2.3.0.tar.bz2
Installing ruby-2.3.0...

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

Inspect or clean up the working tree at /var/folders/0p/7j82ymzd0wd9nlxxz08927ww0000gn/T/ruby-build.20170103045921.71504
Results logged to /var/folders/0p/7j82ymzd0wd9nlxxz08927ww0000gn/T/ruby-build.20170103045921.71504.log

Last 10 log lines:
  Referenced from: /private/var/folders/0p/7j82ymzd0wd9nlxxz08927ww0000gn/T/ruby-build.20170103045921.71504/ruby-2.3.0/./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/0p/7j82ymzd0wd9nlxxz08927ww0000gn/T/ruby-build.20170103045921.71504/ruby-2.3.0/./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

色々調べているとコマンドラインツールを必要なようなので確認

toshiyuki@MacBook-Air [05時26分37秒] [~]
-> % brew --config
HOMEBREW_VERSION: 0.9.9
ORIGIN: https://github.com/Homebrew/brew.git
HEAD: e3b6c96b5dbb3529832f19347781bc2cedd6ab5a
Last commit: 6 months ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: 4a355f7e67a625b03e87947f510196615fa21d99
Core tap last commit: 38 minutes ago
HOMEBREW_PREFIX: /usr/local
HOMEBREW_REPOSITORY: /usr/local
HOMEBREW_CELLAR: /usr/local/Cellar
HOMEBREW_BOTTLE_DOMAIN: https://homebrew.bintray.com
CPU: quad-core 64-bit broadwell
Clang: 8.0 build 800
Git: 2.9.0 => /usr/local/bin/git
Perl: /usr/bin/perl
Python: /usr/bin/python
Ruby: /usr/bin/ruby => /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby
Java: 1.6.0_65-b14-468
System Ruby: 2.0.0-p648
OS X: 10.11.5-x86_64
Xcode: 8.2
CLT: N/A
X11: 2.7.9 => /opt/X11

CLT: N/A

コマンドラインツールのインストールを実施

toshiyuki@MacBook-Air [05時27分56秒] [~]
-> % xcode-select --install
xcode-select: note: install requested for command line developer tools

再度、brew --configで確認

toshiyuki@MacBook-Air [05時29分34秒] [~]
-> % brew --config
HOMEBREW_VERSION: 0.9.9
ORIGIN: https://github.com/Homebrew/brew.git
HEAD: e3b6c96b5dbb3529832f19347781bc2cedd6ab5a
Last commit: 6 months ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: 4a355f7e67a625b03e87947f510196615fa21d99
Core tap last commit: 43 minutes ago
HOMEBREW_PREFIX: /usr/local
HOMEBREW_REPOSITORY: /usr/local
HOMEBREW_CELLAR: /usr/local/Cellar
HOMEBREW_BOTTLE_DOMAIN: https://homebrew.bintray.com
CPU: quad-core 64-bit broadwell
Clang: 8.0 build 800
Git: 2.9.0 => /usr/local/bin/git
Perl: /usr/bin/perl
Python: /usr/bin/python
Ruby: /usr/bin/ruby => /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby
Java: 1.6.0_65-b14-468
System Ruby: 2.0.0-p648
OS X: 10.11.5-x86_64
Xcode: 8.2
CLT: 8.2.0.0.1.1480973914
X11: 2.7.9 => /opt/X11

再度Rubyのインストールを実施!

toshiyuki@MacBook-Air [05時34分07秒] [~]
-> % 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 /usr/local/opt/rbenv/versions/2.3.1

無事、インストールできました!

参考

www.task-notes.com

blog.tstylestudio.com