Installing MeCab on OSX

Posted on Thu 08 October 2015 in Notes

In the In the there are only instruction on how to install on Windows and Linux, but not for OSX, despite the program working quite nicely on Mac.

Kousei Ikeda has easy to follow instruction on his Ikekou blog reprinted here in English.

MeCab

We install from the Terminal, using the following commands:

$ cd ~/Downloads
$ curl -O https://mecab.googlecode.com/files/mecab-0.996.tar.gz
$ tar zxfv mecab-0.996.tar.gz
$ cd mecab-0.996
$ ./configure
$ make
$ make check

This downloads the source from Google Code, unpacks it and compile and check compilation.

IPADIC

Next we need to install a dictionary file / language model for MeCab. The recommended model is IPADIC.

$ cd ~/Downloads
$ $ curl -O https://mecab.googlecode.com/files/mecab-ipadic-2.7.0-20070801.tar.gz
$ tar zxfv mecab-ipadic-2.7.0-20070801.tar.gz
$ cd mecab-ipadic-2.7.0-20070801
$ ./configure --with-charset=utf8
$ make
$ sudo make install

This downloads the source code, unpacks it and compiles the dictionary using UTF-8 character encoding.

Note that the above code downloads from googlecode.com, which is deprecated. The project is inaccessible from Google code and is currently hosted on Github (here) so it is uncertain how long the zipped source will be available there.

Check the download section of the documentation for links to the currently newest version of both IPADIC and MeCab.

After this is done you can use pip to install MeCab bindings for python like this:

$ pip install mecab-python3