創建.ruby-version
文件,1.8.7
後,在該文件是提供了以下錯誤同一目錄下運行rbenv install
:rbenv無法在MacOS X塞拉利昂安裝Ruby 1.8.7
ERROR: This package must be compiled with GCC, but ruby-build couldn't find a suitable
gcc
executable on your system. Please install GCC and try again.DETAILS: Apple no longer includes the official GCC compiler with Xcode as of version 4.2. Instead, the
gcc
executable is a symlink tollvm-gcc
, a modified version of GCC which outputs LLVM bytecode.For most programs the
llvm-gcc
compiler works fine. However, versions of Ruby older than 1.9.3-p125 are incompatible withllvm-gcc
. To build older versions of Ruby you must have the official GCC compiler installed on your system.TO FIX THE PROBLEM: Install Homebrew's apple-gcc42 package with this command: brew tap homebrew/dupes ; brew install apple-gcc42
You will need to install the official GCC compiler to build older versions of Ruby even if you have installed Apple's Command Line Tools for Xcode package. The Command Line Tools for Xcode package only includes
llvm-gcc
.BUILD FAILED (OS X 10.12.4 using ruby-build 20170405-2-g3b15693)
然後運行brew install apple-gcc42
得到:
apple-gcc42: This formula either does not compile or function as expected on macOS versions newer than Mavericks due to an upstream incompatibility. Error: An unsatisfied requirement failed this build.
卡住試圖在MacOS X Sierra上通過rbenv安裝ruby 1.8.7。有想法該怎麼解決這個嗎?
究竟什麼是你的問題? –
您是否將答案作爲問題的一部分發布?(將其轉換爲下面的答案) –
謝謝Holger和Tom的評論。編輯該問題以澄清併發布解決方案作爲答案。 –