LoginSignup
0
0

More than 3 years have passed since last update.

Railsでアプリケーションを起動する際にffiのインストールに失敗した時の対処法

Posted at

Ruby on RailsでRailsのバージョンインストールには成功したものの、Railsのアプリケーションを起動した際に以下のようにffiのインストールに失敗しました。
その際に行なった対処法を残しておきます。

エラーメッセージ

An error occurred while installing ffi (1.13.1), and Bundler cannot continue.
Make sure that `gem install ffi -v '1.13.1' --source 'https://rubygems.org/'` succeeds before bundling.

原因

おそらくMacOSのMojave環境に原因があるらしいです。
原因としては、HomebrewでRubyをインストールするとどうやらffiが無いそうです。

解決方法

まず、ffiがないのでMojave用のlibffiを再インストールします。以下の方法で再インストールします。

brew reinstall libffi

ただ、現状ではlibffiのパスが見えない場所にあるので指定します。

export LDFLAGS="-L/usr/local/opt/libffi/lib" && \
export PKG_CONFIG_PATH="/usr/local/opt/libffi/lib/pkgconfig" && \
bundle install

これでffiのインストールエラーがなくなりrailsのアプリケーションが起動できました!

参照記事

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