起こった事
rails s
でローカルでアプリを起動しようとしたところ、mysqlのエラーが発生したため対応を行った。
内容を理解していないが、後から振り返るため対応をここにメモしておく。
発生したエラー
/Users/user_name/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/mysql2-0.4.10/lib/mysql2.rb:31:in
require': dlopen(/Users/user_name/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/mysql2-0.4.10/lib/mysql2/mysql2.bundle, 9): Library not loaded: /usr/local/opt/mysql/lib/libmysqlclient.20.dylib (LoadError)
‘
Referenced from: /Users/user_name/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/mysql2-0.4.10/lib/mysql2/mysql2.bundle
Reason: image not found - /Users/user_name/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/mysql2-0.4.10/lib/mysql2/mysql2.bundle
from /Users/user_name/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/mysql2-0.4.10/lib/mysql2.rb:31:in
from /Users/user_name/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.16.5/lib/bundler/runtime.rb:81:inrequire'
block (2 levels) in require’
from /Users/user_name/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.16.5/lib/bundler/runtime.rb:81:in
from /Users/user_name/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.16.5/lib/bundler/runtime.rb:76:ineach'
block in require’
from /Users/user_name/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.16.5/lib/bundler/runtime.rb:76:in
from /Users/user_name/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.16.5/lib/bundler/runtime.rb:65:ineach'
require’
from /Users/user_name/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.16.5/lib/bundler/runtime.rb:65:in
from /Users/user_name/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.16.5/lib/bundler.rb:114:inrequire'
‘
from /Users/user_name/projects/chat-space/config/application.rb:5:in
from /Users/user_name/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/railties-5.0.7/lib/rails/commands/commands_tasks.rb:88:inrequire'
block in server’
from /Users/user_name/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/railties-5.0.7/lib/rails/commands/commands_tasks.rb:88:in
from /Users/user_name/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/railties-5.0.7/lib/rails/commands/commands_tasks.rb:85:intap'
server’
from /Users/user_name/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/railties-5.0.7/lib/rails/commands/commands_tasks.rb:85:in
from /Users/user_name/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/railties-5.0.7/lib/rails/commands/commands_tasks.rb:49:inrun_command!'
‘
from /Users/user_name/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/railties-5.0.7/lib/rails/commands.rb:18:in
from /Users/user_name/projects/chat-space/bin/rails:9:inrequire'
‘
from /Users/user_name/projects/chat-space/bin/rails:9:in
from /Users/user_name/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/spring-2.0.2/lib/spring/client/rails.rb:28:inload'
call’
from /Users/user_name名/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/spring-2.0.2/lib/spring/client/rails.rb:28:in
from /Users/user_name/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/spring-2.0.2/lib/spring/client/command.rb:7:incall'
run’
from /Users/user_name/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/spring-2.0.2/lib/spring/client.rb:30:in
from /Users/user_name/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/spring-2.0.2/bin/spring:49:in<top (required)>'
load’
from /Users/user_name/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/spring-2.0.2/lib/spring/binstub.rb:31:in
from /Users/user_name/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/spring-2.0.2/lib/spring/binstub.rb:31:in<top (required)>'
require’
from /Users/user_name/.rbenv/versions/2.3.1/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:68:in
from /Users/user_name/.rbenv/versions/2.3.1/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:68:inrequire'
‘
from /Users/user_name/projects/chat-space/bin/spring:15:in
from bin/rails:3:inload'
from bin/rails:3:in
‘