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?
Update
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 <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
Can someone please help me figure this one out? Thanks in advance.
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:
UPDATE
If you need gcc to compile a certain version of Ruby, you should install homebrew, and then install gcc using this command:
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).