簡體   English   中英

在Mac OSX 10.8.2上安裝Jekyll時出錯

[英]Error while installing Jekyll on Mac OSX 10.8.2

我是Ruby的新手,而命令行則相對較新。 我正在嘗試安裝Jekyll來構建靜態站點,並且遇到一些問題。 我安裝了Ruby 1.8.7版和Ruby Gems 1.8.25版,但是在運行時出現此錯誤:

$ sudo gem install jekyll

我得到這個:

Building native extensions.  This could take a while...
ERROR:  Error installing jekyll:
ERROR: Failed to build gem native extension.

    /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb
mkmf.rb can't find header files for ruby at /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/ruby.h


Gem files will remain installed in /Library/Ruby/Gems/1.8/gems/fast-stemmer-1.0.1 for inspection.
Results logged to /Library/Ruby/Gems/1.8/gems/fast-stemmer-1.0.1/ext/gem_make.out

誰能告訴我如何為ruby安裝頭文件? 是否需要將它們安裝在特定目錄中? 我是否需要在其他目錄中完全重新安裝Ruby,因為這是Mac隨附的原始安裝/設置?

更新

我已經安裝了XCode和RVM,但無法超越這一點。 當我嘗試安裝Ruby時,得到以下信息:

Daniels-MacBook-Air:~ danielrosenthal$ rvm -v

rvm 1.18.3 (stable) by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.io/]

Daniels-MacBook-Air:~ danielrosenthal$ rvm install 1.8.7
Searching for binary rubies, this might take some time.
No binary rubies available for: osx/10.8/x86_64/ruby-1.8.7-p371.
Continuing with compilation. Please read 'rvm mount' to get more information on binary rubies.
The provided compiler '/usr/bin/gcc' is LLVM based, it is not yet fully supported by ruby and gems, please read `rvm requirements`.
Daniels-MacBook-Air:~ danielrosenthal$ rvm requirements
Requirements for osx/10.8/x86_64

NOTE: 'ruby' represents Matz's Ruby Interpreter (MRI) (1.8.X, 1.9.X)
             This is the *original* / standard Ruby Language Interpreter
      'ree'  represents Ruby Enterprise Edition
      'rbx'  represents Rubinius

Additional Dependencies:
# For update-system:
Always update your system first!

# For rvm:
Install: bash curl git patch

# For ruby:
Install: osx-gcc-installer libksba openssl libreadline git zlib1g libyaml libsqlite3     sqlite3 libxml2 libxslt autoconf libc6 libgdbm ncurses automake libtool bison pkg-config

# For jruby:
Install: openjdk ant

有人可以幫我解決這個問題嗎? 提前致謝。

除了(或取決於工具,取決於Xtool)Xcode,您還需要命令行工具,該工具可以從Xcode的首選項窗格中安裝。 Xcode可以在App Store中找到,並且應該免費或非常便宜。

順便說一句,我強烈建議您不要將系統本身的紅寶石弄亂。 安裝rvm以獲得一個完全隔離的ruby版本(您可以選擇自己喜歡的版本),您可以在其中安裝所有gem。

安裝rvm后,只需執行以下操作:

rvm install 1.8.7
rvm use 1.8.7
gem install jekyll

UPDATE

如果需要gcc編譯特定版本的Ruby,則應安裝homebrew ,然后使用以下命令安裝gcc:

brew tap homebrew/dupes && brew install apple-gcc42

否則,嘗試安裝ruby 1.9.3,哪個AFAIK應該可以與LLVM / GCC一起使用(我現在不在Mac上,無法檢查)。

我過去曾經做過,但是個人並不記得所有細節。 您可以嘗試在超級用戶上查看此相關帖子(解決方案2:“找不到頭文件”): https : //superuser.com/questions/154292/ruby-rubygems-why-do-i-always-得到錯誤的消息,當-試圖安裝的,寶石

如果尚未安裝Xcode,請按照上述說明進行安裝( https://developer.apple.com/xcode/ )。 另外,您需要命令行工具。

打開Xcode。 轉到Preferences > Downloads > Install Command Line Tools

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM