Error while installing json gem 'mkmf.rb can't find header files for ruby'
Modern era update, as stated by mimoralea:
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
or, generic way:
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
gem install: Failed to build gem native extension (can't find header files)
For those who may be confused by the accepted answer, as I was, you also need to have the ruby headers installed [ruby-devel].
The article that saved my hide is here.
And this is the revised solution (note that I'm on Fedora 13):
yum -y install gcc mysql-devel ruby-devel rubygems
gem install -y mysql -- --with-mysql-config=/usr/bin/mysql_config
For Debian, and other distributions using Debian style packaging the ruby development headers are installed by:
sudo apt-get install ruby-dev
For Ubuntu the ruby development headers are installed by:
sudo apt-get install ruby-all-dev
If you are using a earlier version of ruby (such as 2.2), then you will need to run:
sudo apt-get install ruby2.2-dev
(where 2.2 is your desired Ruby version)
Error: Failed to build gem native extension (can't find header files for ruby.h)
Well I suspect you actually need ruby2.4-dev if you're using ruby 2.4. But I'd recommend not using system ruby and installing gems globally with sudo
in the first place. Using a ruby environment manager such as rbenv is the best way to avoid dependency hell. Here's a good overview of the available options: http://kgrz.io/programmers-guide-to-choosing-ruby-version-manager.html
Ruby on Rails webp-ffi gem installation fails. Can't find C header files
I solved this by uninstalling everything (node.js, ruby, rbenv, homebrew, etc.) and redoing the whole install process using Rosetta.
To use Rosetta right click on your Terminal application, go to 'Get Info', and check the 'Launch Using Rosetta' checkbox
gem native extension error while installing cocoapods
Open Terminal
curl -L https://get.rvm.io | bash -s stable
Reopen Terminal
rvm install ruby-2.6
rvm use ruby-2.6.3
rvm --default use 2.6.3
From MahmoudKhaled's comment on
link
Related Topics
Can't Connect to MySQL Server Error 111
Error Related to Only_Full_Group_By When Executing a Query in MySQL
How to Use Parameters in Vba in the Different Contexts in Microsoft Access
How to Select the Newest Four Items Per Category
Postgresql Distinct on With Different Order By
Null in MySQL (Performance & Storage)
How to Combine Date from One Field With Time from Another Field - Ms SQL Server
How to Write a Full Outer Join Query in Access
Check If Value Exists in Postgres Array
How to Find the MySQL My.Cnf Location
Are Postgresql Column Names Case-Sensitive
You Can't Specify Target Table For Update in from Clause
Computed/Calculated/Virtual/Derived Columns in Postgresql
Insert Statement Conflicted With the Foreign Key Constraint - SQL Server
SQL Server 2012 Column Identity Increment Jumping from 6 to 1000+ on 7Th Entry