12
14

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

MacOSを上げたら注意! gem native extensionのエラー対策

12
Last updated at Posted at 2016-10-23

環境

MacOS: 10.12 Sierra
Ruby: 2.1.0
Homebrew: 1.0.8


# 状況
bundle installをすると、gemを入れろと怒られる。
しかし、gemを入れるとgem native extensionのエラーが出る。
>

$ bundle install

An error occurred while installing bcrypt (3.1.11), and Bundler cannot continue.
Make sure that gem install bcrypt -v '3.1.11' succeeds before bundling.

$ gem install crypt -v ‘3.1.11’

ERROR: Error installing bcrypt:
ERROR: Failed to build gem native extension.


ググると、このエラーでハマる人が結構いる模様。

# 結論

私の場合、**native extensionは罠**でした。
(bundlerを消したり、installしたりするも、行き詰まる。
約5時間格闘...。)

エラー文中の赤や黄色の文字に目を奪われていましたが、
文中に目を移すと以下のエラー。
>

compiling generator.c
couldn't understand kern.osversion `16.0.0'


osversion...
ここで、MacOSをYosemiteからSierraにアップデートしていたことを思い出す。

上記のエラーを検索すると、、、
あったあった、先人の知恵が。

> [`couldn't understand kern.osversion '14.5.0'` でコンパイルエラーするときの対処法](http://qiita.com/d_forest/items/e285d33b047e73ebbfcd)
[OS X Mountain Lion: gcc-4.2 No such file or directory](https://goo.gl/Rs3hKz)

apple-gcc42が悪さをしていた模様。
インストールをし直して、解決!
>

$ brew uninstall apple-gcc42
$ brew install apple-gcc42


# 関連記事
[gem インストール時に発生したエラーとその解決方法まとめ](https://goo.gl/CdvJrO)
[Why won't the bcrypt ruby gem install properly?](https://goo.gl/VZzfKi)

12
14
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
12
14

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?