[Ruby on Rails 4] macOS Sierra, ruby 2.4.0 環境で bundle install 時に json インストールでエラーが発生する場合の対処

v1.8 ブランチを参照するように Gemfile を指定する。

[markdown]
## 症状

`bundle install` で下記のエラーが発生。
`gem install` でもエラーが発生する。

“`prettyprinted
An error occurred while installing json (1.8.3), and Bundler cannot continue.
Make sure that `gem install json -v ‘1.8.3’` succeeds before bundling.
“`

環境は macOS Sierra, ruby 2.4.0 。

“`prettyprinted
% sw_vers
ProductName: Mac OS X
ProductVersion: 10.12.2
BuildVersion: 16C67
% ruby -v
ruby 2.4.0p0 (2016-12-24 revision 57164) [x86_64-darwin16]
“`

## 対応

現行の v1.8.3 ではなく、最新ブランチを参照するよう Gemfile に指定する。

> * [json-1.8.3 Gem::Ext::BuildError: ERROR: Failed to build gem native extension. · Issue #253 · flori/json](https://github.com/flori/json/issues/253#issuecomment-270294986)

“`ruby:Gemfile
source ‘https://rubygems.org’
gem ‘rails’, ‘~> 4.2.7’
# for macOS Sierra & ruby 2.4
gem ‘json’, git: ‘https://github.com/flori/json.git’, branch: ‘v1.8’
“`

`bundle install` 後、rails 4 とともに下記のバージョンがインストールされた。

“`prettyprinted
% bundle list |grep json
* json (1.8.5 c7a6e31)
“`
[/markdown]