What to do if ffi installation fails when launching an application in Rails

I succeeded in installing the Rails version with Ruby on Rails, but when I started the Rails application, the installation of ffi failed as shown below. I will leave the remedy I took at that time.

Error message

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.

Cause

Probably due to the Mojave environment of MacOS. As for the cause, it seems that there is no ffi when installing Ruby with Homebrew.

Solution

First, reinstall libffi for Mojave because you don't have ffi. Reinstall using the following method.

brew reinstall libffi

However, at present, the libffi path is invisible, so specify it.

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

Now the ffi installation error is gone and the rails application is running!

Reference article

Recommended Posts

What to do if ffi installation fails when launching an application in Rails
What to do when you launch an application with rails
What to do if the debug gem installation fails
What to do if password authentication fails in Docker/Postgres
What to do when an UnsupportedCharsetException occurs in a lightweight JRE
What to do if the Rails page doesn't appear in Rails tutorial 1.3.2
What to do if Cloud9 is full in the Rails tutorial
What to do if you get an error in Basic authentication during Rails test code
<Dot installation> What to do if you cannot proceed due to an error when building a development environment for Rails learning.
[Programming beginner] What to do when rails s becomes an error in the local development environment
What to do if an error occurs when doing npm install axios in React + Typescript project
What to do if you get an error during rails db: reset
What to do when Blocked Host: "host name" appears in Ruby on Rails
What to do and how to install when an error occurs in DXRuby 1.4.7
What to do if an error occurs when nokogiri enters when bundle install
What to do if tomcat process remains when tomcat is stopped in eclipse
What to do if you get an error when you hit Heroku logs
What to do if mvn archetype: generate fails
What to do when IllegalStateException occurs in PlayFramework
What to do if build from command line fails in Android development environment
What to do if the Rails server can't start
What to do if ClassNotFoundException occurs when starting Tomcat
What to do if rails server can't be stopped
What to do when rails creates a 〇〇 2.rb file
What to do if an ActionController :: UnknownFormat error occurs
What to do if you can't get the text of an element in Selenium
What to do when Address already in use is displayed after executing rails s
What to do if you get an error saying "Please enter a valid value" when getting with Rails datetime_field
What to do if you get an error saying "Could not find a JavaScript runtime." When starting rails server
What to do if you get a java.io.IOException in GlassFish
What to do when Method not found in f: ajax
What to do if you can't use the rails command
[Rails Tutorial Chapter 2] What to do when you make a mistake in the column name
[Rails] What to do if you can't get an error message with the errors method
What to do when Rails on Docker does not reflect controller changes in the browser
What to do when an error occurs in rails db: migrate ((StandardError: An error has occurred, this and all later migrations canceled :))
What to do when javax.batch.operations.JobStartException occurs
What to do if you get a gcc error in Docker
[Rails] What to do when rails s does not respond or does not stop
What to do if you get a DISPLAY error in gym.render ()
What to do if you forget the root password in CentOS7
[Rails] What to do if you can't get parameters with form_with
[Rails] What to do when the error No database selected and Unknown database appears in db: migrate
Notes on what to do if Ubuntu 20.04 installation on Virtual box 6.1 (Windows10) fails with "Error 5 Input / output error"
What to do if you get a "Mysql2 :: Error: Operand should contain 1 column (s)" error in Rails
What to do if you get a JNI shared library error when trying to build in Eclipse
What to do if you get an [An HTTP request took too long to complete.] Error in Docker.
What to do if the app is not created with the latest Rails version installed when rails new
What to do if you get a groovy warning in Thymeleaf Layout
Add gem'rails-i18n','~> 6.0.0' and what to do if bundle install gives an error
What to do if you get an error with bundle install by entering gem'bcrypt' in your Gemfile
What to do when a javax.el.PropertyNotWritableException occurs
What to do if you get Application with name appName is already registered. When you try to start GlassFish
What to do if you should have installed Rails but an error occurs with rails -v (for beginners)
What to do if the image posted by refile disappears after setting a 404 error page in Rails
What to do if zip dies if there is a pom when making an executable jar with gradle
What to do if deployment fails on Heroku (Ruby app not detected)
no space left on device What to do if an error occurs
What to do if you can't bundle update and bundle install after installing Ruby 3.0.0 in the Rails tutorial
What to do if an error occurs in VS Code when importing a django module or your own module installed by pip install
What to do if Operation not permitted is displayed when you execute a command in the terminal