【解決】An error occurred while installing nokogiri (1.10.8), and Bundler cannot continue. Make sure that `gem install nokogiri -v '1.10.8' --source 'https://rubygems.org/'` succeeds before bundling.

## Macのストレージ(その他)を綺麗にしたらRailsの開発環境がイカれた②

### bundle installでつまづく

```
$ bundle install
Warning: the running version of Bundler (2.0.2) is older than the version that created the lockfile (2.1.4). We suggest you upgrade to the latest version of Bundler by running `gem install bundler`.
The dependency tzinfo-data (>= 0) will be unused by any of the platforms Bundler is installing for. Bundler is installing for ruby but the dependency is only for x86-mingw32, x86-mswin32, x64-mingw32, java. To add those platforms to the bundle, run `bundle lock --add-platform x86-mingw32 x86-mswin32 x64-mingw32 java`.
Fetching gem metadata from https://rubygems.org/............
Using rake 13.0.1
Using concurrent-ruby 1.1.6
Using i18n 1.8.2
Using minitest 5.14.0
Using thread_safe 0.3.6
Using tzinfo 1.2.6
Using activesupport 5.2.4.1
Using builder 3.2.4
Using erubi 1.9.0
Using mini_portile2 2.4.0
Fetching nokogiri 1.10.8
Installing nokogiri 1.10.8 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: /Users/jun/dic/mannyou_assignment/vendor/bundle/gems/nokogiri-1.10.8/ext/nokogiri
/Users/jun/.rbenv/versions/2.6.5/bin/ruby -I /Users/jun/.rbenv/versions/2.6.5/lib/ruby/2.6.0 -r ./siteconf20200303-71983-e1s2zu.rb extconf.rb --use-system-libraries
checking if the C compiler accepts  -I /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/libxml2... yes
checking if the C compiler accepts -Wno-error=unused-command-line-argument-hard-error-in-future... no
Building nokogiri using system libraries.
checking for xmlParseDoc() in libxml/parser.h... yes
checking for xsltParseStylesheetDoc() in libxslt/xslt.h... yes
checking for exsltFuncRegister() in libexslt/exslt.h... yes
checking for xmlHasFeature()... yes
checking for xmlFirstElementChild()... yes
checking for xmlRelaxNGSetParserStructuredErrors()... yes
checking for xmlRelaxNGSetParserStructuredErrors()... yes
checking for xmlRelaxNGSetValidStructuredErrors()... yes
checking for xmlSchemaSetValidStructuredErrors()... yes
checking for xmlSchemaSetParserStructuredErrors()... yes
creating Makefile

current directory: /Users/jun/dic/mannyou_assignment/vendor/bundle/gems/nokogiri-1.10.8/ext/nokogiri
make "DESTDIR=" clean

current directory: /Users/jun/dic/mannyou_assignment/vendor/bundle/gems/nokogiri-1.10.8/ext/nokogiri
make "DESTDIR="
compiling html_document.c
compiling html_element_description.c
compiling html_entity_lookup.c
compiling html_sax_parser_context.c
compiling html_sax_push_parser.c
compiling nokogiri.c
compiling xml_attr.c
compiling xml_attribute_decl.c
compiling xml_cdata.c
xml_cdata.c:29:23: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
    content_str_len = RSTRING_LEN(content);
                    ~ ^~~~~~~~~~~~~~~~~~~~
/Users/jun/.rbenv/versions/2.6.5/include/ruby-2.6.0/ruby/ruby.h:1000:6: note: expanded from macro 'RSTRING_LEN'
     RSTRING_EMBED_LEN(str) : \
     ^~~~~~~~~~~~~~~~~~~~~~
/Users/jun/.rbenv/versions/2.6.5/include/ruby-2.6.0/ruby/ruby.h:996:6: note: expanded from macro 'RSTRING_EMBED_LEN'
     (long)((RBASIC(str)->flags >> RSTRING_EMBED_LEN_SHIFT) & \
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
xml_cdata.c:29:23: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
    content_str_len = RSTRING_LEN(content);
                    ~ ^~~~~~~~~~~~~~~~~~~~
/Users/jun/.rbenv/versions/2.6.5/include/ruby-2.6.0/ruby/ruby.h:1001:28: note: expanded from macro 'RSTRING_LEN'
     RSTRING(str)->as.heap.len)
     ~~~~~~~~~~~~~~~~~~~~~~^~~
2 warnings generated.
compiling xml_comment.c
compiling xml_document.c
compiling xml_document_fragment.c
compiling xml_dtd.c
xml_dtd.c:47:47: warning: incompatible pointer types passing 'void (void *, void *, const xmlChar *)' (aka 'void (void *, void *, const unsigned char *)') to parameter of type
'xmlHashScanner' (aka 'void (*)(void *, void *, unsigned char *)') [-Wincompatible-pointer-types]
  xmlHashScan((xmlHashTablePtr)dtd->entities, element_copier, (void *)hash);
                                              ^~~~~~~~~~~~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/libxml2/libxml/hash.h:210:22: note: passing argument to parameter 'f' here
                                         xmlHashScanner f,
                                                        ^
xml_dtd.c:69:48: warning: incompatible pointer types passing 'void (void *, void *, const xmlChar *)' (aka 'void (void *, void *, const unsigned char *)') to parameter of type
'xmlHashScanner' (aka 'void (*)(void *, void *, unsigned char *)') [-Wincompatible-pointer-types]
  xmlHashScan((xmlHashTablePtr)dtd->notations, notation_copier, (void *)hash);
                                               ^~~~~~~~~~~~~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/libxml2/libxml/hash.h:210:22: note: passing argument to parameter 'f' here
                                         xmlHashScanner f,
                                                        ^
xml_dtd.c:91:49: warning: incompatible pointer types passing 'void (void *, void *, const xmlChar *)' (aka 'void (void *, void *, const unsigned char *)') to parameter of type
'xmlHashScanner' (aka 'void (*)(void *, void *, unsigned char *)') [-Wincompatible-pointer-types]
  xmlHashScan((xmlHashTablePtr)dtd->attributes, element_copier, (void *)hash);
                                                ^~~~~~~~~~~~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/libxml2/libxml/hash.h:210:22: note: passing argument to parameter 'f' here
                                         xmlHashScanner f,
                                                        ^
xml_dtd.c:113:47: warning: incompatible pointer types passing 'void (void *, void *, const xmlChar *)' (aka 'void (void *, void *, const unsigned char *)') to parameter of type
'xmlHashScanner' (aka 'void (*)(void *, void *, unsigned char *)') [-Wincompatible-pointer-types]
  xmlHashScan((xmlHashTablePtr)dtd->elements, element_copier, (void *)hash);
                                              ^~~~~~~~~~~~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/libxml2/libxml/hash.h:210:22: note: passing argument to parameter 'f' here
                                         xmlHashScanner f,
                                                        ^
4 warnings generated.
compiling xml_element_content.c
compiling xml_element_decl.c
compiling xml_encoding_handler.c
compiling xml_entity_decl.c
compiling xml_entity_reference.c
compiling xml_io.c
compiling xml_libxml2_hacks.c
compiling xml_namespace.c
compiling xml_node.c
xml_node.c:304:15: warning: passing 'const xmlChar *' (aka 'const unsigned char *') to parameter of type 'void *' discards qualifiers
[-Wincompatible-pointer-types-discards-qualifiers]
      xmlFree(reparentee->ns->prefix);
              ^~~~~~~~~~~~~~~~~~~~~~
1 warning generated.
compiling xml_node_set.c
compiling xml_processing_instruction.c
compiling xml_reader.c
compiling xml_relax_ng.c
compiling xml_sax_parser.c
compiling xml_sax_parser_context.c
compiling xml_sax_push_parser.c
compiling xml_schema.c
compiling xml_syntax_error.c
compiling xml_text.c
compiling xml_xpath_context.c
compiling xslt_stylesheet.c
xslt_stylesheet.c:112:13: warning: unused function 'swallow_superfluous_xml_errors' [-Wunused-function]
static void swallow_superfluous_xml_errors(void * userdata, xmlErrorPtr error, ...)
            ^
1 warning generated.
linking shared-object nokogiri/nokogiri.bundle
Cleaning files only used during build.
rm -rf /Users/jun/dic/mannyou_assignment/vendor/bundle/gems/nokogiri-1.10.8/ports/archives

current directory: /Users/jun/dic/mannyou_assignment/vendor/bundle/gems/nokogiri-1.10.8/ext/nokogiri
make "DESTDIR=" install
make: /usr/local/bin/gmkdir: No such file or directory
make: *** [.sitearchdir.-.nokogiri.time] Error 1

make install failed, exit code 2

Gem files will remain installed in /Users/jun/dic/mannyou_assignment/vendor/bundle/gems/nokogiri-1.10.8 for inspection.
Results logged to /Users/jun/dic/mannyou_assignment/vendor/bundle/extensions/x86_64-darwin-18/2.6.0/nokogiri-1.10.8/gem_make.out

An error occurred while installing nokogiri (1.10.8), and Bundler cannot continue.
Make sure that `gem install nokogiri -v '1.10.8' --source 'https://rubygems.org/'` succeeds before bundling.

In Gemfile:
  rails was resolved to 5.2.4.1, which depends on
    actioncable was resolved to 5.2.4.1, which depends on
      actionpack was resolved to 5.2.4.1, which depends on
        actionview was resolved to 5.2.4.1, which depends on
          rails-dom-testing was resolved to 2.0.3, which depends on
            nokogiri

```


## やったこと

[この記事に従い](https://qiita.com/t_732_twit/items/a7956a170b1694f7ffc2)

**brewを最新にする**

```
$ brew doctor
$ brew update
$ brew upgrade
```


**必須ファイルをインストール**

```
$ brew tap homebrew/dupes
$ brew install libxml2 libxslt libiconv
$ brew link --force libxml2
$ brew link --force libxslt
```

それから[この記事](https://qiita.com/takeru56/items/9dc2b2aec56aaed69740)に従い

**Command Line Toolsの最新版をインストールして**
※[XcodeなしでCommand Line Toolsをインストール](https://qiita.com/___inon_/items/4a318f29e1dd68ad8071)

下記を実行

```
$ brew install coreutils

==> Downloading https://homebrew.bintray.com/bottles/coreutils-8.31.catalina.bottle.1.tar.gz
==> Downloading from https://akamai.bintray.com/72/7262e4c76483ea796454db828c25955be1e6b2bc8e056ba1dd6e92bfe1118da5?__gda__=exp=1583202888~hmac=ab492d29f1d3a565a7c992effc388df25d
######################################################################## 100.0%
==> Pouring coreutils-8.31.catalina.bottle.1.tar.gz
==> Caveats
Commands also provided by macOS have been installed with the prefix "g".
If you need to use these commands with their normal names, you
can add a "gnubin" directory to your PATH from your bashrc like:
  PATH="/usr/local/opt/coreutils/libexec/gnubin:$PATH"
==> Summary
🍺  /usr/local/Cellar/coreutils/8.31: 476 files, 9.2MB
```

**bin**に移り、下記がしっかりインストールされているか確認

```
$ cd /usr/local/bin
$ ls | grep gmk
gmkdir
gmkfifo
gmknod
gmktemp
```

**nokogiriインストール**

```
$ gem install nokogiri -v '1.10.8' --source 'https://rubygems.org/'
```

**bundle install**

```
$ bundle
Warning: the running version of Bundler (2.0.2) is older than the version that created the lockfile (2.1.4). We suggest you upgrade to the latest version of Bundler by running `gem install bundler`.
The dependency tzinfo-data (>= 0) will be unused by any of the platforms Bundler is installing for. Bundler is installing for ruby but the dependency is only for x86-mingw32, x86-mswin32, x64-mingw32, java. To add those platforms to the bundle, run `bundle lock --add-platform x86-mingw32 x86-mswin32 x64-mingw32 java`.
Fetching gem metadata from https://rubygems.org/............
Using rake 13.0.1
Using concurrent-ruby 1.1.6
Using i18n 1.8.2
Using minitest 5.14.0
Using thread_safe 0.3.6
Using tzinfo 1.2.6
Using activesupport 5.2.4.1
Using builder 3.2.4
Using erubi 1.9.0
Using mini_portile2 2.4.0
Fetching nokogiri 1.10.8
Installing nokogiri 1.10.8 with native extensions
Fetching rails-dom-testing 2.0.3
Installing rails-dom-testing 2.0.3
Fetching crass 1.0.6
Installing crass 1.0.6
Fetching loofah 2.4.0
Installing loofah 2.4.0
Fetching rails-html-sanitizer 1.3.0
Installing rails-html-sanitizer 1.3.0
Fetching actionview 5.2.4.1
Installing actionview 5.2.4.1
Fetching rack 2.2.2
Installing rack 2.2.2
Fetching rack-test 1.1.0
Installing rack-test 1.1.0
Fetching actionpack 5.2.4.1
Installing actionpack 5.2.4.1
Fetching nio4r 2.5.2
Installing nio4r 2.5.2 with native extensions
Fetching websocket-extensions 0.1.4
Installing websocket-extensions 0.1.4
Fetching websocket-driver 0.7.1
Installing websocket-driver 0.7.1 with native extensions
Fetching actioncable 5.2.4.1
Installing actioncable 5.2.4.1
Fetching globalid 0.4.2
Installing globalid 0.4.2
Fetching activejob 5.2.4.1
Installing activejob 5.2.4.1
Fetching mini_mime 1.0.2
Installing mini_mime 1.0.2
Fetching mail 2.7.1
Installing mail 2.7.1
Fetching actionmailer 5.2.4.1
Installing actionmailer 5.2.4.1
Fetching activemodel 5.2.4.1
Installing activemodel 5.2.4.1
Fetching arel 9.0.0
Installing arel 9.0.0
Fetching activerecord 5.2.4.1
Installing activerecord 5.2.4.1
Fetching mimemagic 0.3.4
Installing mimemagic 0.3.4
Fetching marcel 0.3.3
Installing marcel 0.3.3
Fetching activestorage 5.2.4.1
Installing activestorage 5.2.4.1
Fetching public_suffix 4.0.3
Installing public_suffix 4.0.3
Fetching addressable 2.7.0
Installing addressable 2.7.0
Fetching io-like 0.3.1
Installing io-like 0.3.1
Fetching archive-zip 0.12.0
Installing archive-zip 0.12.0
Fetching execjs 2.7.0
Installing execjs 2.7.0
Fetching autoprefixer-rails 9.7.4
Installing autoprefixer-rails 9.7.4
Fetching coderay 1.1.2
Installing coderay 1.1.2
Fetching better_errors 2.6.0
Installing better_errors 2.6.0
Fetching bindex 0.8.1
Installing bindex 0.8.1 with native extensions
Fetching msgpack 1.3.3
Installing msgpack 1.3.3 with native extensions
Fetching bootsnap 1.4.6
Installing bootsnap 1.4.6 with native extensions
Fetching popper_js 1.16.0
Installing popper_js 1.16.0
Fetching method_source 0.9.2
Installing method_source 0.9.2
Fetching thor 1.0.1
Installing thor 1.0.1
Fetching railties 5.2.4.1
Installing railties 5.2.4.1
Fetching ffi 1.12.2
Installing ffi 1.12.2 with native extensions
Fetching sassc 2.2.1
Installing sassc 2.2.1 with native extensions
Fetching sprockets 3.7.2
Installing sprockets 3.7.2
Fetching sprockets-rails 3.2.1
Installing sprockets-rails 3.2.1
Fetching tilt 2.0.10
Installing tilt 2.0.10
Fetching sassc-rails 2.1.2
Installing sassc-rails 2.1.2
Fetching bootstrap 4.4.1
Installing bootstrap 4.4.1
Using bundler 2.0.2
Fetching byebug 11.1.1
Installing byebug 11.1.1 with native extensions
Fetching regexp_parser 1.7.0
Installing regexp_parser 1.7.0
Fetching xpath 3.2.0
Installing xpath 3.2.0
Fetching capybara 3.31.0
Installing capybara 3.31.0
Fetching childprocess 3.0.0
Installing childprocess 3.0.0
Fetching chromedriver-helper 2.1.1
Installing chromedriver-helper 2.1.1
Fetching coffee-script-source 1.12.2
Installing coffee-script-source 1.12.2
Fetching coffee-script 2.4.1
Installing coffee-script 2.4.1
Fetching coffee-rails 4.2.2
Installing coffee-rails 4.2.2
Fetching database_cleaner 1.8.3
Installing database_cleaner 1.8.3
Fetching diff-lcs 1.3
Installing diff-lcs 1.3
Fetching factory_bot 5.1.1
Installing factory_bot 5.1.1
Fetching factory_bot_rails 5.1.1
Installing factory_bot_rails 5.1.1
Fetching faker 2.10.2
Installing faker 2.10.2
Fetching jbuilder 2.10.0
Installing jbuilder 2.10.0
Fetching jquery-rails 4.3.5
Installing jquery-rails 4.3.5
Fetching kaminari-core 1.2.0
Installing kaminari-core 1.2.0
Fetching kaminari-actionview 1.2.0
Installing kaminari-actionview 1.2.0
Fetching kaminari-activerecord 1.2.0
Installing kaminari-activerecord 1.2.0
Fetching kaminari 1.2.0
Installing kaminari 1.2.0
Fetching launchy 2.5.0
Installing launchy 2.5.0
Fetching rb-fsevent 0.10.3
Installing rb-fsevent 0.10.3
Fetching rb-inotify 0.10.1
Installing rb-inotify 0.10.1
Fetching ruby_dep 1.5.0
Installing ruby_dep 1.5.0
Fetching listen 3.1.5
Installing listen 3.1.5
Fetching pg 1.2.2
Installing pg 1.2.2 with native extensions
Fetching pry 0.12.2
Installing pry 0.12.2
Fetching pry-rails 0.3.9
Installing pry-rails 0.3.9
Fetching puma 3.12.3
Installing puma 3.12.3 with native extensions
Fetching rails 5.2.4.1
Installing rails 5.2.4.1
Fetching rspec-support 3.9.2
Installing rspec-support 3.9.2
Fetching rspec-core 3.9.1
Installing rspec-core 3.9.1
Fetching rspec-expectations 3.9.0
Installing rspec-expectations 3.9.0
Fetching rspec-mocks 3.9.1
Installing rspec-mocks 3.9.1
Fetching rspec-rails 3.9.0
Installing rspec-rails 3.9.0
Fetching rubyzip 2.2.0
Installing rubyzip 2.2.0
Fetching sass-listen 4.0.0
Installing sass-listen 4.0.0
Fetching sass 3.7.4
Installing sass 3.7.4
Fetching sass-rails 5.1.0
Installing sass-rails 5.1.0
Fetching selenium-webdriver 3.142.7
Installing selenium-webdriver 3.142.7
Fetching spring 2.1.0
Installing spring 2.1.0
Fetching spring-watcher-listen 2.0.1
Installing spring-watcher-listen 2.0.1
Fetching turbolinks-source 5.2.0
Installing turbolinks-source 5.2.0
Fetching turbolinks 5.2.1
Installing turbolinks 5.2.1
Fetching uglifier 4.2.0
Installing uglifier 4.2.0
Fetching web-console 3.7.0
Installing web-console 3.7.0
Fetching webdrivers 4.2.0
Installing webdrivers 4.2.0
Bundle complete! 29 Gemfile dependencies, 104 gems now installed.
Bundled gems are installed into `./vendor/bundle`
Post-install message from chromedriver-helper:

  +--------------------------------------------------------------------+
  |                                                                    |
  |  NOTICE: chromedriver-helper is deprecated after 2019-03-31.       |
  |                                                                    |
  |  Please update to use the 'webdrivers' gem instead.                |
  |  See https://github.com/flavorjones/chromedriver-helper/issues/83  |
  |                                                                    |
  +--------------------------------------------------------------------+

Post-install message from sass:

Ruby Sass has reached end-of-life and should no longer be used.

* If you use Sass as a command-line tool, we recommend using Dart Sass, the new
  primary implementation: https://sass-lang.com/install

* If you use Sass as a plug-in for a Ruby web framework, we recommend using the
  sassc gem: https://github.com/sass/sassc-ruby#readme

* For more details, please refer to the Sass blog:
  https://sass-lang.com/blog/posts/7828841
```

入った！


****

### Macのストレージ(その他)を綺麗にしたらRailsの開発環境がイカれた

Macのストレージ(その他)を綺麗にしたらRailsの開発環境がイカれた①
[ruby -vができない](https://qiita.com/___inon_/items/aaed570712bfbae3116d)

Macのストレージ(その他)を綺麗にしたらRailsの開発環境がイカれた②
[bundle installでつまづく](https://qiita.com/___inon_/items/c898c67f536f9d2d766c)　　　　 ← ここ

Macのストレージ(その他)を綺麗にしたらRailsの開発環境がイカれた②
[rails db:createができない](https://qiita.com/___inon_/items/1ad3e2594dc0d35b9568)