Reputation: 35
I am new to Ruby, and relatively new to the command line. I am trying to install Jekyll to build a static site, and am having some issues. I have Ruby v. 1.8.7 and Ruby Gems v. 1.8.25 installed, but I get this error when I run:
$ sudo gem install jekyll
I get this:
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
Can anyone tell me how to install the header files for ruby? Do I need to install them in a specific directory? Do I need to reinstall Ruby entirely in a different directory, as this is the original installing/setup that came with my Mac?
I have installed XCode and installed RVM, but am unable to get past that point. When I try to install Ruby, I get this:
Daniels-MacBook-Air:~ danielrosenthal$ rvm -v
rvm 1.18.3 (stable) by Wayne E. Seguin <[email protected]>, Michal Papis <[email protected]> [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
Can someone please help me figure this one out? Thanks in advance.
Upvotes: 2
Views: 3448
Reputation: 3169
Beyond (or instead of, it depends on the tool) Xcode, you'll need the Command Line Tools, which can be installed from a preference pane in Xcode. Xcode can be found in the App Store and should be free or very cheap.
By the way, I highly recommend you don't mess with the system's own ruby; install rvm in order to get a fully isolated ruby version (you can pick the version you prefer) where you can install all your gems.
Once rvm is installed, just do something like:
rvm install 1.8.7
rvm use 1.8.7
gem install jekyll
UPDATE
If you need gcc to compile a certain version of Ruby, you should install homebrew, and then install gcc using this command:
brew tap homebrew/dupes && brew install apple-gcc42
Otherwise try installing ruby 1.9.3 which AFAIK should work with LLVM/GCC (I'm not on a Mac right now and cannot check).
Upvotes: 4
Reputation: 18602
Install Xcode as mentioned if you don't have it installed already (https://developer.apple.com/xcode/). Plus you need the command line tools.
Open Xcode. Go to Preferences > Downloads > Install Command Line Tools
Upvotes: 0
Reputation: 2510
I've done this in the past, but don't personally remember all the details. You might try looking at this related post over on superuser (Solution #2: "Can't find header files"): https://superuser.com/questions/154292/ruby-rubygems-why-do-i-always-get-error-messages-when-trying-to-install-gems
Upvotes: 0