ffi  Library not loaded: /opt/brew/opt/libffi/lib/libffi.6.dylibのエラーを直す



## 概要
brew updateしたあとに発生したエラー
rspecが落ちる

## 今回の直し方

**symlinkを貼る**

### 採用理由
- あんまり調べなくて良い
- 早い

### 懸念点
- updateのときに意図せずなんかなって嵌りそう

まあいいか


TODO: 公式issueにも一応載っているので今度読む。もしどなたか読んだ方いらしたらぜひ教えて下さいませ(他力本願...)
[dyld: Library not loaded: /usr/local/opt/libffi/lib/libffi\.6\.dylib · Issue \#7 · platformio/platform\-lattice\_ice40](https://github.com/platformio/platform-lattice_ice40/issues/7)

## エラー抜粋

```bash
LoadError:
  dlopen(/Users/user/dev/my-markdown/vendor/bundler/ruby/2.6.0/gems/ffi-1.11.1/lib/ffi_c.bundle, 9): Library not loaded: /opt/brew/opt/libffi/lib/libffi.6.dylib

```

## 探索

`/opt/brew/opt/libffi/lib/libffi.6.dylib` not loadedなので、言ってみる

```bash
➤ cd /opt/brew/opt/libffi/lib/
➤ ls
libffi.7.dylib libffi.a       libffi.dylib   pkgconfig
```

確かに`libffi.6.dylib`がない

## symlinkを貼る
```bash
ln libffi.7.dylib libffi.6.dylib
```

**直った**
## 感想
多分、libffi.6.dylibになるように、何かしらreinstallなどしたほうがよいのだろうが、面倒なのでしないでおこう。

以上、またエラーが出たら対処する or issue今度読む方針の雑な直し方でした。

## 付録: エラー全容

```bash
➤ rspec spec/models/post_spec.rb:6

An error occurred while loading ./spec/models/post_spec.rb.
Failure/Error: require File.expand_path('../../config/environment', __FILE__)

LoadError:
  dlopen(/Users/user/dev/my-markdown/vendor/bundler/ruby/2.6.0/gems/ffi-1.11.1/lib/ffi_c.bundle, 9): Library not loaded: /opt/brew/opt/libffi/lib/libffi.6.dylib
    Referenced from: /Users/use(neocomplete_start_auto_complete)/dev/my-markdown/vendor/bundler/ruby/2.6.0/gems/ffi-1.11.1/lib/ffi_c.bundle
    Reason: image not found - /Users/user/dev/my-markdown/vendor/bundler/ruby/2.6.0/gems/ffi-1.11.1/lib/ffi_c.bundle
# ./vendor/bundler/ruby/2.6.0/gems/ffi-1.11.1/lib/ffi.rb:6:in `require'
# ./vendor/bundler/ruby/2.6.0/gems/ffi-1.11.1/lib/ffi.rb:6:in `rescue in <top (required)>'
# ./vendor/bundler/ruby/2.6.0/gems/ffi-1.11.1/lib/ffi.rb:3:in `<top (required)>'
# ./vendor/bundler/ruby/2.6.0/gems/sassc-2.3.0/lib/sassc/native.rb:3:in `require'
# ./vendor/bundler/ruby/2.6.0/gems/sassc-2.3.0/lib/sassc/native.rb:3:in `<top (required)>'
# ./vendor/bundler/ruby/2.6.0/gems/sassc-2.3.0/lib/sassc.rb:31:in `require_relative'
# ./vendor/bundler/ruby/2.6.0/gems/sassc-2.3.0/lib/sassc.rb:31:in `<top (required)>'
# ./vendor/bundler/ruby/2.6.0/gems/sassc-rails-2.1.2/lib/sassc/rails.rb:5:in `require'
# ./vendor/bundler/ruby/2.6.0/gems/sassc-rails-2.1.2/lib/sassc/rails.rb:5:in `<top (required)>'
# ./vendor/bundler/ruby/2.6.0/gems/sassc-rails-2.1.2/lib/sassc-rails.rb:3:in `require_relative'
# ./vendor/bundler/ruby/2.6.0/gems/sassc-rails-2.1.2/lib/sassc-rails.rb:3:in `<top (required)>'
# ./vendor/bundler/ruby/2.6.0/gems/administrate-0.13.0/lib/administrate/engine.rb:5:in `require'
# ./vendor/bundler/ruby/2.6.0/gems/administrate-0.13.0/lib/administrate/engine.rb:5:in `<top (required)>'
# ./vendor/bundler/ruby/2.6.0/gems/administrate-0.13.0/lib/administrate.rb:1:in `require'
# ./vendor/bundler/ruby/2.6.0/gems/administrate-0.13.0/lib/administrate.rb:1:in `<top (required)>'
# ./config/application.rb:22:in `<top (required)>'
# ./config/environment.rb:4:in `require_relative'
# ./config/environment.rb:4:in `<top (required)>'
# ./spec/rails_helper.rb:6:in `require'
# ./spec/rails_helper.rb:6:in `<top (required)>'
# ./spec/models/post_spec.rb:3:in `require'
# ./spec/models/post_spec.rb:3:in `<top (required)>'
# ------------------
# --- Caused by: ---
# LoadError:
#   cannot load such file -- 2.6/ffi_c
#   ./vendor/bundler/ruby/2.6.0/gems/ffi-1.11.1/lib/ffi.rb:4:in `require'
Run options: include {:locations=>{"./spec/models/post_spec.rb"=>[6]}}

All examples were filtered out

Randomized with seed 34574


Finished in 0.00064 seconds (files took 2.04 seconds to load)
0 examples, 0 failures, 1 error occurred outside of examples


```