Unable to install ruby-filemagic 0.7.1 on Mac even though libmagic has been installed.
The error is like :
checking for main() in -lgnurx... no
checking for magic_open() in -lmagic... no
*** ERROR: missing required library to compile this module
* extconf.rb failed *
Almost all answers fo ruby-filemagic installation are the brew install libmagic
. However, it doesn't work.
A few hours were cost before I found the problem. Let me write down the cause and solution here :
cause:
my
ruby
($HOME/.rbenv/versions/x.x.x/bin/ruby
) was under the control ofrbenv
, however mybundler
was controlled by oldruby
(/usr/local/ruby
) . The stupidbundler
could not find the library for installingruby_filemagic
and wasted so much time.solution:
$ rbenv exec gem install bundler $ rbenv rehash
makebundler
,gem
,ruby
under the same management.Sorry for my poor English. I hope this may help more people.