Help us understand the problem. What is going on with this article?

Bundlerでmecabをインストールする際に 'mecab.h' file not found になった時の対処

More than 3 years have passed since last update.

概要

以下の環境で bundle install した際に 'mecab.h' file not found になったので、解決策とエラー内容をメモっておきます。

  • Mac OS X El Capitan
  • ruby-2.2.3p173 (rbenv)
  • MeCab-0.996をHomebrewでインストール済み
  • mecabのgemをBundlerでインストールしようとする

解決策

bundle configmecab.h の在処を教えてやればOK

$ bundle config build.mecab --with-cppflags=-I/usr/local/Cellar/mecab/0.996/include

エラー内容

$ bundle install --path vendor/bundle
...
Installing mecab 0.996 with native extensions

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    /usr/local/var/rbenv/versions/2.2.3/bin/ruby -r ./siteconf20160308-35660-17ft5zo.rb extconf.rb
checking for make... yes
checking for main() in -lstdc++... yes
checking for main() in -lmecab... yes
checking for main() in -lstdc++... yes
checking for mecab.h... yes
creating Makefile

make "DESTDIR=" clean

make "DESTDIR="
compiling mecab_wrap.cpp
mecab_wrap.cpp:1855:10: fatal error: 'mecab.h' file not found
#include "mecab.h"
         ^
1 error generated.
make: *** [mecab_wrap.o] Error 1

make failed, exit code 2
...

参考

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした