I am using the 'stock' version of Ruby 1.8.7 that came with my Mac OS X (Lion) and when I try to install Rails I get missing header file errors. How can I fix?
Thanks
sudo gem install rails
Building native extensions. This could take a while...
ERROR: Error installing rails:
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
The XCode "Command Line Tools" package includes not only the compiler, but the developer headers for many different packages, Ruby included.
The gem tool really should check for the presence of this before blindly trying to execute things, but that does not appear to be the case, and instead you get cryptic messages like this.
Related
I was trying to install gem sqlite3 but failed with error below.
ERROR: Error installing sqlite3:
ERROR: Failed to build gem native extension.
/usr/local/opt/ruby/bin/ruby -r ./siteconf20151016-8328-1i1buur.rb extconf.rb --with-sqlite3-dir /usr/bin
extconf.rb failed
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details.
.....
I just searched through and solved it via installing XCode before installing sqlite3, can anyone tell me the reason? What does XCode actually do?
I am a newbie on those gem of Ruby.
Installing XCode (or more precisely the XCode command line tools) will also install the toolchain needed to compile the native extensions (written in C) needed by the sqlite3 gem.
I've recently installed the latest version of RubyMine, along with Ruby 1.9.3-- that's the version we're on at work.
When I open RubyMine and try to set the SDK to 1.9.3 I'm prompted to update some gems, but then receive errors I can't figure out what to do with. Would anyone know what's going on here and what I can do to fix it? (I do have the latest version of DevKit installed, and in my path.)
mini_magick (3.6.0): While executing gem ... (Errno::EINVAL) Invalid argument - C:/Ruby193/lib/ruby/gems/1.9.1/gems/mini_magick-3.6.0/test/files/special! "chars'.gif diff-lcs (1.2.4):
Error installing diff-lcs: "htmldiff" from diff-lcs conflicts with C:/Ruby193/bin/htmldiff bson (2.0.0.rc1):
Error installing bson: Building native extensions. This could take a while... ERROR: Failed to build gem native extension. C:/Ruby193/bin/ruby.exe extconf.rb
..there are about four more errors for various other gems.
I have Ruby and RubyMine working fine on another box, also on 1.9.3, but can't figure out what might be going on in this instance.
I got this working eventually, by doing removing gems by hand and re-adding them. Not really sure what the final, victorious, step was but doing the previous often enough got all the gems added properly.
I tried to execute 'sudo gem install bcrypt-ruby'
And got the following error:
Building native extensions. This could take a while...
ERROR: Error installing bcrypt-ruby:
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/bcrypt-ruby-3.0.1 for inspection.
Results logged to /Library/Ruby/Gems/1.8/gems/bcrypt-ruby-3.0.1/ext/mri/gem_make.out
I'm running osx lion with ruby 1.8.7 and xcode 4.5.2
(Thanks for helping me)
sudo env ARCHFLAGS="-arch x86_64" gem install do_sqlite3
Building native extensions. This could take a while...
ERROR: Error installing do_sqlite3:
ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb
checking for sqlite3.h... yes
checking for sqlite3_open() in -lsqlite3... no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.
I have sqlite3-ruby installed as well as the header files, but for some reason it fails when checking for sqlite3_open()
I am having the same issue:
sudo env ARCHFLAGS="-arch x86_64" gem install do_sqlite3
Building native extensions. This could take a while...
ERROR: Error installing do_sqlite3:
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/do_sqlite3-0.10.1.1 for inspection.
Results logged to /Library/Ruby/Gems/1.8/gems/do_sqlite3-0.10.1.1/ext/do_sqlite3/gem_make.out
I am running Snow Leopard. I'm not sure about previous installations of sqlite3 but I did try this:
port search sqlite
And it returned the following (among others):
...
sqlite3 #3.6.17 (databases)
an embedded SQL database engine
To be honest I'm not sure what all this means. What would anyone suggest for getting do_sqlite3 installed for use in Rails 3 with DataMapper? (Also, running it without the 'env ARCHFLAGS="-arch x86_64"' gives the same errors.)
Ok, first question is why are you passing the ARCHFLAGS? That should not be necessary, if it also doesn't work without passing them, what is the output you get then?
Next question is what version of sqlite3 is it picking up? Do you have sqlite3 installed through Macports for example? Did you upgrade to Snow Leopard recently and still have an sqlite3 install from before upgrading?
I'm getting the following error when I'm trying to install webrat in my OS X, please suggest me how can i solve this problem.
ERROR:
Error installing webrat:
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/nokogiri-1.4.0 for inspection.
Results logged to /Library/Ruby/Gems/1.8/gems/nokogiri-1.4.0/ext/nokogiri/gem_make.out
Install xcode and dev tools from your osx dvd, or download them from here:
http://developer.apple.com/technologies/xcode.html