[Ruby on Rails 4] nokogiri, mysql2, rmagick の bundle install error 対応作業

macOS 環境で Ruby のバージョンアップ後に、rails v4 の bundle install で error が発生した際の memo.

nokogiri, mysql2, rmagick

% sw_vers
ProductName:    Mac OS X
ProductVersion: 10.14.3
BuildVersion:   18D42
% bundle doctor
The following gems are missing
 * nokogiri (1.8.0) <- 記憶で補完
 * mysql2 (0.4.9)   <- 記憶で補完
 * rmagick (2.16.0)
Install missing gems with `bundle install`

nokogiri

% bundle config build.nokogiri --use-system-libraries --with-xml2-include=$(brew --prefix libxml2)/include/libxml2

mysql2

% sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target /

rmagick

% PKG_CONFIG_PATH=/usr/local/opt/imagemagick@6/lib/pkgconfig bundle install --path vendor/bundle