Install ruby headers with rvm
you are checking in wrong location, check with:
$ find /home/mpapis/.rvm/rubies/ruby-1.9.3-p194/ -name ruby.h
/home/mpapis/.rvm/rubies/ruby-1.9.3-p194/include/ruby-1.9.1/ruby/ruby.h
/home/mpapis/.rvm/rubies/ruby-1.9.3-p194/include/ruby-1.9.1/ruby.h
bundle install using wrong ruby with rvm when building native extension?
I was using the wrong bundle
.
$ which bundle
/usr/bin/bundle
Either the one included in Ubuntu 16.04 is old, or using the system-installed bundler doesn't work with rvm-installed Ruby.$ gem install bundler
Fetching: bundler-1.16.1.gem (100%)
...
1 gem installed
$ which bundle
/home/roger/.rvm/gems/ruby-2.3.4@junk-drawer/bin/bundle
That looks better.$ bundle
Fetching gem metadata from https://rubygems.org/.........
Resolving dependencies...
Using bundler 1.16.1
...
Bundle complete! 1 Gemfile dependency, 9 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
Lesson learned: when using rvm, remember to gem install bundler
as well. Error while installing json gem 'mkmf.rb can't find header files for ruby'
Modern era update, as stated by mimoralea:
or, generic way:In case that you are using ruby 2.0 or 2.2 (thanks @patrick-davey).
sudo apt-get install ruby2.0-dev
sudo apt-get install ruby2.2-dev
sudo apt-get install ruby2.3-dev
sudo apt-get install ruby-dev
or
sudo apt-get install ruby`ruby -e 'puts RUBY_VERSION[/\d+\.\d+/]'`-dev
The first link you’ve posted is exactly your case: there is no ruby development environment installed. Development env is needed to compile ruby extensions, which are mostly written in
C
. Proxy has nothing to do with the problem: everything is downloaded fine, just compilation fails.I would suggest you to install ruby-dev
(ruby-devel
for rpm-based distros) package onto you target machine.
gcc
package might be needed as well.
Try:
$ sudo apt-get install ruby-dev
Or, for Redhat distro:$ sudo yum install ruby-devel
Or, for [open]SuSE:$ sudo zypper install ruby-devel
rvm install ree fails on ubuntu: how to get pass openssl and zlib dev headers requirement?
If you use rvm version 1.9.0,
$ rvm package install ree_dependencies
ERROR: Unrecognized command line argument: 'package' ( see: 'rvm usage' )
Using
$ rvm pkg install ree_dependencies
will work
Cannot install passenger due to Ruby development headers not found
have you tried:
rvm get head
rvm reload
gem install passenger
rvmsudo passenger-install-nginx-module
How to install ruby-debug when needing necessary libraries and/or headers
The error is in the mkmf.log file. That file should be located at /home/hxh/.rvm/gems/ruby-1.9.3-p448/gems/linecache-0.46/ext/linecache/mkmf.log
.
If not, you can use
sudo find / -name mkmf.log
to find it. To troubleshoot further, see "How to install Nokogiri Ruby gem with mkmf.log saying libiconv not found?"
Can't find header files for Ruby on SUSE?
For those with similar issues I got this working by.
Uninsalling ruby and rvm
Building zlib from source with the shared option
./configure --shared
make
make install
I did the same for Ruby and that worked.I could not get any RPM, Zypper, RVM installers to install properly. In each case they all seemed to have issues with zlib ?
Executable Ruby Scripts Using the Current Local User RVM Install?
If you do which ruby
, you'll find that RVM's ruby
does not lie at /usr/bin/ruby
. Instead use:
#!/usr/bin/env ruby
This will tell it to look up which ruby
to use in the current environment (essentially the $PATH
).You could also execute your script via ruby
itself: ruby myscript.rb
Related Topics
How to Test If a Value Is a Prime Number in Ruby? Both The Easy and The Hard Way
Rvm Can No Longer Install 1.8.7-P352 on MAC Os X Mountain Lion
Recommended Way to Generate a Presigned Url to S3 Bucket in Ruby
Paperclip: Integration with Mailboxer Gem
Warning While Installing The Rails Plugin
After_Save Callback to Set The Updated_By Column to The Current_User
Functional Testing of a Restful Post in Ruby on Rails
Using Facebook Connect with Authlogic
Running Rails Console with Bundle Exec
Using Paperclip Within Seeds.Rb
Private Messages with Faye and Rails
Activemodel::Validations on Anonymous Class
Ruby Symbols Are Not Garbage Collected!? Then, Isn't It Better to Use a String
Do I Need to Install Passenger as a Regular Gem Even Though My App Uses Bundler
How to Handle Omniauth Callbacks in Multiple Environments
Where Is Ruby's Erb Format "Officially" Defined
How to Split a String Containing Both Delimiter and The Escaped Delimiter