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

MacのgccでmecabインストールがコケるときはHomebrew経由でgccを入れる

More than 1 year has passed since last update.

pip install mecab-python3 でエラー

2019/01/15現在、Macデフォルトのgcc (xcode-select経由で入るもの)では mecab-python3 のインストール時にエラーが出る。

#include <stdexcept>
             ^~~~~~~~~~~
    1 warning and 1 error generated.
    error: command 'gcc' failed with exit status 1

そのため、Homebrew経由のgccを使う必要がある。

Mecabインストール

$ brew install mecab
$ brew install mecab-ipadic

gccインストール

$ brew install gcc
$ ln -s /usr/local/bin/gcc-8 /usr/local/bin/gcc
$ ln -s /usr/local/bin/g++-8 /usr/local/bin/g++

.bash_profile なり .zshrc なりを編集して、
$ which gcc/usr/local/bin/gcc となるようにする。

mecab-python3 インストール

$ brew install swig
$ pip install mecab-python3

以上でインストールができる。

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
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