기존 루비 온 레일스 프로젝트를 만져봐야 한다.
간단한 것만 아는 수준이라 자신은 없지만, 그래도 해야했다.
근데 회사 맥에 설치할 때는 문제없었는데, 집의 맥에서는 mysql 관련 에러가 난다.
git으로 소스를 받아와서 $ bundle
을 입력했을 때
$ bundle Fetching gem metadata from https://rubygems.org/............ Fetching version metadata from https://rubygems.org/... Fetching dependency metadata from https://rubygems.org/.. Using rake 12.0.0 Using public_suffix 2.0.5 Using unf_ext 0.0.7.2 Using http-form_data 1.0.1 Using http_parser.rb 0.6.0 Using concurrent-ruby 1.0.5 Using i18n 0.8.1 Using minitest 5.10.1 Using thread_safe 0.3.6 Using builder 3.2.3 Using erubis 2.7.0 Using mini_portile2 2.1.0 Using rack 2.0.1 Using nio4r 2.0.0 Using websocket-extensions 0.1.2 Using mime-types-data 3.2016.0521 Using arel 7.1.4 Using method_source 0.8.2 Using thor 0.19.4 Using bundler 1.15.1 Using sqlite3 1.3.13 Using puma 3.8.2 Using sass 3.4.23 Using tilt 2.0.7 Using execjs 2.7.0 Using coffee-script-source 1.12.2 Using turbolinks-source 5.0.0 Using multi_json 1.12.1 Using json 1.8.6 Using rdoc 4.3.0 Using bcrypt 3.1.11 Using orm_adapter 0.5.0 Using jwt 1.5.6 Using hashie 3.5.5 Using multipart-post 2.0.0 Using multi_xml 0.6.0 Using cancancan 1.16.0 Using kaminari-core 1.0.1 Using connection_pool 2.2.1 Using redis 3.3.3 Using mustermann 1.0.0 Using apns 1.0.0 Using mini_magick 4.7.0 Using hkdf 0.3.0 Using chronic 0.10.2 Using slack-notifier 2.1.0 Fetching mysql2 0.4.5 Installing mysql2 0.4.5 with native extensions Using newrelic_rpm 4.0.0.332 Using formtastic_i18n 0.6.0 Using elasticsearch-rails 6.0.0.alpha1 from https://github.com/elasticsearch/elasticsearch-rails.git (at master@64f31b4) Using byebug 9.0.6 Using coderay 1.1.1 Using slop 3.6.0 Using net-ssh 4.1.0 Using bindex 0.5.0 Using rb-fsevent 0.9.8 Using ffi 1.9.18 Using kgio 2.11.0 Using raindrops 0.18.0 Using get_process_mem 0.2.1 Using addressable 2.5.1 Using unf 0.1.4 Using tzinfo 1.2.3 Using nokogiri 1.7.1 Using rack-test 0.6.3 Using sprockets 3.7.1 Using warden 1.2.7 Using rack-protection 2.0.0 from https://github.com/sinatra/sinatra.git (at master@a275ffd) Using websocket-driver 0.6.5 Using mime-types 3.1 Using uglifier 3.1.11 Using coffee-script 2.4.1 Using turbolinks 5.0.1 Using elasticsearch-api 5.0.4 Using sdoc 0.4.2 Using omniauth 1.6.1 Using faraday 0.11.0 Using httparty 0.14.0 Using webpush 0.3.1 Using whenever 0.9.7 Gem::Ext::BuildError: ERROR: Failed to build gem native extension. current directory: /Users/susemi99/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/mysql2-0.4.5/ext/mysql2 /Users/susemi99/.rbenv/versions/2.3.1/bin/ruby -r ./siteconf20170710-75933-9fiob6.rb extconf.rb checking for rb_absint_size()... yes checking for rb_absint_singlebit_p()... yes checking for ruby/thread.h... yes checking for rb_thread_call_without_gvl() in ruby/thread.h... yes checking for rb_thread_blocking_region()... no checking for rb_wait_for_single_fd()... yes checking for rb_hash_dup()... yes checking for rb_intern3()... yes checking for rb_big_cmp()... yes checking for mysql_query() in -lmysqlclient... no ----- mysql client is missing. You may need to 'brew install mysql' or 'port install mysql', and try again. ----- *** extconf.rb failed *** Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers. Check the mkmf.log file for more details. You may need configuration options. Provided configuration options: --with-opt-dir --without-opt-dir --with-opt-include --without-opt-include=${opt-dir}/include --with-opt-lib --without-opt-lib=${opt-dir}/lib --with-make-prog --without-make-prog --srcdir=. --curdir --ruby=/Users/susemi99/.rbenv/versions/2.3.1/bin/$(RUBY_BASE_NAME) --with-mysql-dir --without-mysql-dir --with-mysql-include --without-mysql-include=${mysql-dir}/include --with-mysql-lib --without-mysql-lib=${mysql-dir}/lib --with-mysql-config --without-mysql-config --with-mysql-dir --without-mysql-dir --with-mysql-include --without-mysql-include=${mysql-dir}/include --with-mysql-lib --without-mysql-lib=${mysql-dir}/lib --with-mysqlclientlib --without-mysqlclientlib To see why this extension failed to compile, please check the mkmf.log which can be found here: /Users/susemi99/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/extensions/x86_64-darwin-16/2.3.0-static/mysql2-0.4.5/mkmf.log extconf failed, exit code 1 Gem files will remain installed in /Users/susemi99/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/mysql2-0.4.5 for inspection. Results logged to /Users/susemi99/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/extensions/x86_64-darwin-16/2.3.0-static/mysql2-0.4.5/gem_make.out An error occurred while installing mysql2 (0.4.5), and Bundler cannot continue. Make sure that `gem install mysql2 -v '0.4.5'` succeeds before bundling. In Gemfile: mysql2
이런 에러가 났다.
설명에 나온대로 `$ gem install mysql2 -v ‘0.4.5’` 를 호출하면
$ gem install mysql2 -v '0.4.5' Building native extensions. This could take a while... ERROR: Error installing mysql2: ERROR: Failed to build gem native extension. current directory: /Users/susemi99/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/mysql2-0.4.5/ext/mysql2 /Users/susemi99/.rbenv/versions/2.3.1/bin/ruby -r ./siteconf20170710-76317-1w3giq2.rb extconf.rb checking for rb_absint_size()... yes checking for rb_absint_singlebit_p()... yes checking for ruby/thread.h... yes checking for rb_thread_call_without_gvl() in ruby/thread.h... yes checking for rb_thread_blocking_region()... no checking for rb_wait_for_single_fd()... yes checking for rb_hash_dup()... yes checking for rb_intern3()... yes checking for rb_big_cmp()... yes checking for mysql_query() in -lmysqlclient... no ----- mysql client is missing. You may need to 'brew install mysql' or 'port install mysql', and try again. ----- *** extconf.rb failed *** Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers. Check the mkmf.log file for more details. You may need configuration options. Provided configuration options: --with-opt-dir --without-opt-dir --with-opt-include --without-opt-include=${opt-dir}/include --with-opt-lib --without-opt-lib=${opt-dir}/lib --with-make-prog --without-make-prog --srcdir=. --curdir --ruby=/Users/susemi99/.rbenv/versions/2.3.1/bin/$(RUBY_BASE_NAME) --with-mysql-dir --without-mysql-dir --with-mysql-include --without-mysql-include=${mysql-dir}/include --with-mysql-lib --without-mysql-lib=${mysql-dir}/lib --with-mysql-config --without-mysql-config --with-mysql-dir --without-mysql-dir --with-mysql-include --without-mysql-include=${mysql-dir}/include --with-mysql-lib --without-mysql-lib=${mysql-dir}/lib --with-mysqlclientlib --without-mysqlclientlib To see why this extension failed to compile, please check the mkmf.log which can be found here: /Users/susemi99/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/extensions/x86_64-darwin-16/2.3.0-static/mysql2-0.4.5/mkmf.log extconf failed, exit code 1 Gem files will remain installed in /Users/susemi99/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/mysql2-0.4.5 for inspection. Results logged to /Users/susemi99/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/extensions/x86_64-darwin-16/2.3.0-static/mysql2-0.4.5/gem_make.out
이번엔 이런 에러가 났다.
이리저리 검색해보니 https://stackoverflow.com/a/39730475/1025379 를 찾았고
$ xcode-select --install
로 무언가를 설치하고나서
$ brew install mysql Updating Homebrew... ==> Auto-updated Homebrew! Updated 1 tap (homebrew/core). ==> Updated Formulae folly hugo mongodb pcre ==> Downloading https://homebrew.bintray.com/bottles/mysql-5.7.18_1.sierra.bottle.tar.gz Already downloaded: /Users/susemi99/Library/Caches/Homebrew/mysql-5.7.18_1.sierra.bottle.tar.gz ==> Pouring mysql-5.7.18_1.sierra.bottle.tar.gz ==> Using the sandbox ==> Caveats We've installed your MySQL database without a root password. To secure it run: mysql_secure_installation MySQL is configured to only allow connections from localhost by default To connect run: mysql -uroot To have launchd start mysql now and restart at login: brew services start mysql Or, if you don't want/need a background service you can just run: mysql.server start ==> Summary 🍺 /usr/local/Cellar/mysql/5.7.18_1: 321 files, 232.9MB
을 한 뒤에 $ bundle
을 실행하니 그제서야 잘 됐다.