MothOnMars
MothOnMars

Reputation: 2369

"Error installing charlock_holmes" : "icu required"

I'm attempting to install charlock_holmes on my Mac (10.7.5, ruby-1.9.3-p392), and I'm encountering the following error:

$gem install charlock_holmes -v '0.6.9.4'
Building native extensions.
This could take a while...
ERROR:  Error installing charlock_holmes:
ERROR: Failed to build gem native extension.

/Users/mthompson/.rvm/rubies/ruby-1.9.3-p392/bin/ruby extconf.rb
checking for main() in -licui18n... no
checking for main() in -licui18n... no


***************************************************************************************
*********** icu required (brew install icu4c or apt-get install libicu-dev) ***********
***************************************************************************************
*** 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've installed icu via macports, so my icu directories are /opt/local/lib/icu and /opt/local/share/icu. I've tried installing with the directories specified:

$ gem install charlock_holmes -v '0.6.9.4' -- --with-icu-dir=/opt/local/lib/icu --with-opt-include=/usr/local/include/ --with-opt-lib=/usr/local/lib/

..but I hit the same error. Any ideas would be welcome.

Upvotes: 3

Views: 3509

Answers (3)

user461321
user461321

Reputation:

I ran into this issue today. I realize that the original issue was resolved by switching to Homebrew. That wasn't an acceptable solution to me, so I kept digging. The solution was actually quite simple.

After installing icu via Macports, simply install charlock_holmes by running:

gem install charlock_holmes -- --with-icu-dir=/opt/local

Hopefully this helps others that encounter this issue and are not willing to abandon Macports in order to solve it.

Upvotes: 5

zarthur
zarthur

Reputation: 521

I was able to install this gem using the version of ICU installed with macports and pointing --with-opt-include and --with-opt-lib to subdirectories of /opt.

The gem successfully installed by running:

gem install charlock_holmes -v '0.6.9.4' -- --with-icu-dir=/opt/local/lib/icu --with-opt-include=/opt/local/include/ --with-opt-lib=/opt/local/lib/

Upvotes: 11

MothOnMars
MothOnMars

Reputation: 2369

I ended up switching from MacPorts to Homebrew and reinstalling my rubies and packages.

Upvotes: 2

Related Questions