ruby-debug Could not create Makefile due to some reason, probably lack of 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?"


I am using Mac El Capitan. In my case it was caused by the missing developer tool. I solved it by installing the developer tool via xcode-select --install. After that bundle install worked fine again.


You're most likely missing some file headers (e.g. zlib or libiconv), so try installing them.

Linux: sudo apt-get install libz-dev libiconv-hook1 libiconv-hook-dev

OS X: brew install libiconv && xcode-select --install

Otherwise check your mkmf.log file for more specific details.