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

## bundle install の pg のところでエラー

```
MacBook-Pro-4:sample-app jun$ bundle
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/............
Fetching gem metadata from https://rubygems.org/.
Resolving dependencies...
Using rake 13.0.1
Using concurrent-ruby 1.1.5
Using i18n 1.7.0
Using minitest 5.13.0
Using thread_safe 0.3.6
Using tzinfo 1.2.5
Using activesupport 5.2.4
Using builder 3.2.4
Using erubi 1.9.0
Using mini_portile2 2.4.0
Using nokogiri 1.10.7
Using rails-dom-testing 2.0.3
Using crass 1.0.5
Using loofah 2.4.0
Using rails-html-sanitizer 1.3.0
Using actionview 5.2.4
Using rack 2.0.7
Using rack-test 1.1.0
Using actionpack 5.2.4
Using nio4r 2.5.2
Using websocket-extensions 0.1.4
Using websocket-driver 0.7.1
Using actioncable 5.2.4
Using globalid 0.4.2
Using activejob 5.2.4
Using mini_mime 1.0.2
Using mail 2.7.1
Using actionmailer 5.2.4
Using activemodel 5.2.4
Using arel 9.0.0
Using activerecord 5.2.4
Using mimemagic 0.3.3
Using marcel 0.3.3
Using activestorage 5.2.4
Using public_suffix 4.0.1
Using addressable 2.7.0
Using io-like 0.3.0
Using archive-zip 0.12.0
Using bindex 0.8.1
Using msgpack 1.3.1
Using bootsnap 1.4.5
Using bundler 2.0.2
Using byebug 11.0.1
Using regexp_parser 1.6.0
Using xpath 3.2.0
Using capybara 3.29.0
Using childprocess 3.0.0
Using chromedriver-helper 2.1.1
Using coffee-script-source 1.12.2
Using execjs 2.7.0
Using coffee-script 2.4.1
Using method_source 0.9.2
Using thor 1.0.0
Using railties 5.2.4
Using coffee-rails 4.2.2
Using ffi 1.11.3
Using jbuilder 2.9.1
Using rb-fsevent 0.10.3
Using rb-inotify 0.10.0
Using ruby_dep 1.5.0
Using listen 3.1.5
Fetching pg 1.1.4
Installing pg 1.1.4 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: /Users/jun/dic/sample-app/vendor/bundle/ruby/2.6.0/gems/pg-1.1.4/ext
/Users/jun/.rbenv/versions/2.6.5/bin/ruby -I /Users/jun/.rbenv/versions/2.6.5/lib/ruby/2.6.0 -r ./siteconf20191216-89619-d2khz.rb extconf.rb
--with-pg-config\=/usr/pgsql-9.3/bin/pg_config
Using config values from /usr/pgsql-9.3/bin/pg_config
sh: /usr/pgsql-9.3/bin/pg_config: No such file or directory
sh: /usr/pgsql-9.3/bin/pg_config: No such file or directory
checking for libpq-fe.h... yes
checking for libpq/libpq-fs.h... yes
checking for pg_config_manual.h... yes
checking for PQconnectdb() in -lpq... yes
checking for PQsetSingleRowMode()... yes
checking for PQconninfo()... yes
checking for PQsslAttribute()... yes
checking for PQencryptPasswordConn()... yes
checking for timegm()... yes
checking for rb_gc_adjust_memory_usage()... yes
checking for PG_DIAG_TABLE_NAME in libpq-fe.h... yes
checking for unistd.h... yes
checking for inttypes.h... yes
checking for C99 variable length arrays... yes
creating extconf.h
creating Makefile

current directory: /Users/jun/dic/sample-app/vendor/bundle/ruby/2.6.0/gems/pg-1.1.4/ext
make "DESTDIR=" clean

current directory: /Users/jun/dic/sample-app/vendor/bundle/ruby/2.6.0/gems/pg-1.1.4/ext
make "DESTDIR="
compiling gvl_wrappers.c
compiling pg.c
compiling pg_binary_decoder.c
compiling pg_binary_encoder.c
compiling pg_coder.c
pg_coder.c:206:34: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
        res = this->dec_func(this, val, RSTRING_LEN(argv[0]), tuple, field, ENCODING_GET(argv[0]));
              ~~~~                      ^~~~~~~~~~~~~~~~~~~~
/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) & \
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
pg_coder.c:206:34: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
        res = this->dec_func(this, val, RSTRING_LEN(argv[0]), tuple, field, ENCODING_GET(argv[0]));
              ~~~~                      ^~~~~~~~~~~~~~~~~~~~
/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 pg_connection.c
compiling pg_copy_coder.c
pg_copy_coder.c:225:15: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
                                        strlen = RSTRING_LEN(subint);
                                               ~ ^~~~~~~~~~~~~~~~~~~
/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) & \
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
pg_copy_coder.c:225:15: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
                                        strlen = RSTRING_LEN(subint);
                                               ~ ^~~~~~~~~~~~~~~~~~~
/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)
     ~~~~~~~~~~~~~~~~~~~~~~^~~
pg_copy_coder.c:531:23: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
                input_len = end_ptr - start_ptr;
                          ~ ~~~~~~~~^~~~~~~~~~~
3 warnings generated.
compiling pg_errors.c
compiling pg_result.c
compiling pg_text_decoder.c
compiling pg_text_encoder.c
pg_text_encoder.c:170:14: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
                        len = out - start;
                            ~ ~~~~^~~~~~~
pg_text_encoder.c:289:15: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
                return optr - out;
                ~~~~~~ ~~~~~^~~~~
pg_text_encoder.c:293:12: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
                return 2 + RSTRING_LEN(*intermediate) * 2;
                ~~~~~~ ~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
pg_text_encoder.c:500:13: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
        nr_elems = RARRAY_LEN(value);
                 ~ ^~~~~~~~~~~~~~~~~
/Users/jun/.rbenv/versions/2.6.5/include/ruby-2.6.0/ruby/ruby.h:1058:23: note: expanded from macro 'RARRAY_LEN'
#define RARRAY_LEN(a) rb_array_len(a)
                      ^~~~~~~~~~~~~~~
4 warnings generated.
compiling pg_tuple.c
pg_tuple.c:475:15: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
        num_fields = RARRAY_LEN(values);
                   ~ ^~~~~~~~~~~~~~~~~~
/Users/jun/.rbenv/versions/2.6.5/include/ruby-2.6.0/ruby/ruby.h:1058:23: note: expanded from macro 'RARRAY_LEN'
#define RARRAY_LEN(a) rb_array_len(a)
                      ^~~~~~~~~~~~~~~
1 warning generated.
compiling pg_type_map.c
compiling pg_type_map_all_strings.c
compiling pg_type_map_by_class.c
compiling pg_type_map_by_column.c
pg_type_map_by_column.c:161:52: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
        return dec_func( p_coder, RSTRING_PTR(field_str), RSTRING_LEN(field_str), 0, fieldno, enc_idx );
               ~~~~~~~~                                   ^~~~~~~~~~~~~~~~~~~~~~
/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) & \
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
pg_type_map_by_column.c:161:52: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
        return dec_func( p_coder, RSTRING_PTR(field_str), RSTRING_LEN(field_str), 0, fieldno, enc_idx );
               ~~~~~~~~                                   ^~~~~~~~~~~~~~~~~~~~~~
/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)
     ~~~~~~~~~~~~~~~~~~~~~~^~~
pg_type_map_by_column.c:230:17: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
        conv_ary_len = RARRAY_LEN(conv_ary);
                     ~ ^~~~~~~~~~~~~~~~~~~~
/Users/jun/.rbenv/versions/2.6.5/include/ruby-2.6.0/ruby/ruby.h:1058:23: note: expanded from macro 'RARRAY_LEN'
#define RARRAY_LEN(a) rb_array_len(a)
                      ^~~~~~~~~~~~~~~
3 warnings generated.
compiling pg_type_map_by_mri_type.c
compiling pg_type_map_by_oid.c
compiling pg_type_map_in_ruby.c
compiling util.c
util.c:119:24: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
        return (char*)out_ptr - out;
        ~~~~~~ ~~~~~~~~~~~~~~~^~~~~
1 warning generated.
linking shared-object pg_ext.bundle
ld: file not found: dynamic_lookup
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [pg_ext.bundle] Error 1

make failed, exit code 2

Gem files will remain installed in /Users/jun/dic/sample-app/vendor/bundle/ruby/2.6.0/gems/pg-1.1.4 for inspection.
Results logged to /Users/jun/dic/sample-app/vendor/bundle/ruby/2.6.0/extensions/x86_64-darwin-18/2.6.0/pg-1.1.4/gem_make.out

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

In Gemfile:
  pg
```


言われるるがまま

```
$ gem install pg -v '1.1.4' --source 'https://rubygems.org/'
```

を実行してpgはインストールできるが

```
MacBook-Pro-4:sample-app jun$ gem install pg -v '1.1.4' --source 'https://rubygems.org/'
Building native extensions. This could take a while...
Successfully installed pg-1.1.4
Parsing documentation for pg-1.1.4
Done installing documentation for pg after 1 seconds
1 gem installed
```

bundle installはこける

```
MacBook-Pro-4:sample-app jun$ bundle
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/............
Fetching gem metadata from https://rubygems.org/.
Resolving dependencies...
Using rake 13.0.1
Using concurrent-ruby 1.1.5
Using i18n 1.7.0
Using minitest 5.13.0
Using thread_safe 0.3.6
Using tzinfo 1.2.5
Using activesupport 5.2.4
Using builder 3.2.4
Using erubi 1.9.0
Using mini_portile2 2.4.0
Using nokogiri 1.10.7
Using rails-dom-testing 2.0.3
Using crass 1.0.5
Using loofah 2.4.0
Using rails-html-sanitizer 1.3.0
Using actionview 5.2.4
Using rack 2.0.7
Using rack-test 1.1.0
Using actionpack 5.2.4
Using nio4r 2.5.2
Using websocket-extensions 0.1.4
Using websocket-driver 0.7.1
Using actioncable 5.2.4
Using globalid 0.4.2
Using activejob 5.2.4
Using mini_mime 1.0.2
Using mail 2.7.1
Using actionmailer 5.2.4
Using activemodel 5.2.4
Using arel 9.0.0
Using activerecord 5.2.4
Using mimemagic 0.3.3
Using marcel 0.3.3
Using activestorage 5.2.4
Using public_suffix 4.0.1
Using addressable 2.7.0
Using io-like 0.3.0
Using archive-zip 0.12.0
Using bindex 0.8.1
Using msgpack 1.3.1
Using bootsnap 1.4.5
Using bundler 2.0.2
Using byebug 11.0.1
Using regexp_parser 1.6.0
Using xpath 3.2.0
Using capybara 3.29.0
Using childprocess 3.0.0
Using chromedriver-helper 2.1.1
Using coffee-script-source 1.12.2
Using execjs 2.7.0
Using coffee-script 2.4.1
Using method_source 0.9.2
Using thor 1.0.0
Using railties 5.2.4
Using coffee-rails 4.2.2
Using ffi 1.11.3
Using jbuilder 2.9.1
Using rb-fsevent 0.10.3
Using rb-inotify 0.10.0
Using ruby_dep 1.5.0
Using listen 3.1.5
Fetching pg 1.1.4
Installing pg 1.1.4 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
```

## 解決策

```
$ brew reinstall postgresql
$ brew info openssl
$ bundle config build.pg --use-system-libraries 
$ bundle config --local build.pg --use-system-libraries
$ bundle config
$ gem install pg -v '1.1.4' --source 'https://rubygems.org/'
$ bundle install
```

以上！！！

## 履歴

```
MacBook-Pro-4:sample-app jun$  brew info openssl
openssl@1.1: stable 1.1.1d (bottled) [keg-only]
Cryptography and SSL/TLS Toolkit
https://openssl.org/
/usr/local/Cellar/openssl@1.1/1.1.1d (7,983 files, 17.9MB)
  Poured from bottle on 2019-09-20 at 19:00:22
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/openssl@1.1.rb
==> Caveats
A CA file has been bootstrapped using certificates from the system
keychain. To add additional certificates, place .pem files in
  /usr/local/etc/openssl@1.1/certs

and run
  /usr/local/opt/openssl@1.1/bin/c_rehash

openssl@1.1 is keg-only, which means it was not symlinked into /usr/local,
because openssl/libressl is provided by macOS so don't link an incompatible version.

If you need to have openssl@1.1 first in your PATH run:
  echo 'export PATH="/usr/local/opt/openssl@1.1/bin:$PATH"' >> ~/.bash_profile

For compilers to find openssl@1.1 you may need to set:
  export LDFLAGS="-L/usr/local/opt/openssl@1.1/lib"
  export CPPFLAGS="-I/usr/local/opt/openssl@1.1/include"

For pkg-config to find openssl@1.1 you may need to set:
  export PKG_CONFIG_PATH="/usr/local/opt/openssl@1.1/lib/pkgconfig"

==> Analytics
install: 492,916 (30 days), 1,756,066 (90 days), 2,537,136 (365 days)
install-on-request: 72,982 (30 days), 165,468 (90 days), 443,205 (365 days)
build-error: 0 (30 days)
MacBook-Pro-4:sample-app jun$ gem install pg -v '1.1.4' --source 'https://rubygems.org/'
Building native extensions. This could take a while...
Successfully installed pg-1.1.4
Parsing documentation for pg-1.1.4
Done installing documentation for pg after 0 seconds
1 gem installed
MacBook-Pro-4:sample-app jun$ bundle
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/............
Fetching gem metadata from https://rubygems.org/.
Resolving dependencies...
Using rake 13.0.1
Using concurrent-ruby 1.1.5
Using i18n 1.7.0
Using minitest 5.13.0
Using thread_safe 0.3.6
Using tzinfo 1.2.5
Using activesupport 5.2.4
Using builder 3.2.4
Using erubi 1.9.0
Using mini_portile2 2.4.0
Using nokogiri 1.10.7
Using rails-dom-testing 2.0.3
Using crass 1.0.5
Using loofah 2.4.0
Using rails-html-sanitizer 1.3.0
Using actionview 5.2.4
Using rack 2.0.7
Using rack-test 1.1.0
Using actionpack 5.2.4
Using nio4r 2.5.2
Using websocket-extensions 0.1.4
Using websocket-driver 0.7.1
Using actioncable 5.2.4
Using globalid 0.4.2
Using activejob 5.2.4
Using mini_mime 1.0.2
Using mail 2.7.1
Using actionmailer 5.2.4
Using activemodel 5.2.4
Using arel 9.0.0
Using activerecord 5.2.4
Using mimemagic 0.3.3
Using marcel 0.3.3
Using activestorage 5.2.4
Using public_suffix 4.0.1
Using addressable 2.7.0
Using io-like 0.3.0
Using archive-zip 0.12.0
Using bindex 0.8.1
Using msgpack 1.3.1
Using bootsnap 1.4.5
Using bundler 2.0.2
Using byebug 11.0.1
Using regexp_parser 1.6.0
Using xpath 3.2.0
Using capybara 3.29.0
Using childprocess 3.0.0
Using chromedriver-helper 2.1.1
Using coffee-script-source 1.12.2
Using execjs 2.7.0
Using coffee-script 2.4.1
Using method_source 0.9.2
Using thor 1.0.0
Using railties 5.2.4
Using coffee-rails 4.2.2
Using ffi 1.11.3
Using jbuilder 2.9.1
Using rb-fsevent 0.10.3
Using rb-inotify 0.10.0
Using ruby_dep 1.5.0
Using listen 3.1.5
Fetching pg 1.1.4
Installing pg 1.1.4 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: /Users/jun/dic/sample-app/vendor/bundle/ruby/2.6.0/gems/pg-1.1.4/ext
/Users/jun/.rbenv/versions/2.6.5/bin/ruby -I /Users/jun/.rbenv/versions/2.6.5/lib/ruby/2.6.0 -r ./siteconf20191216-89619-d2khz.rb extconf.rb
--with-pg-config\=/usr/pgsql-9.3/bin/pg_config
Using config values from /usr/pgsql-9.3/bin/pg_config
sh: /usr/pgsql-9.3/bin/pg_config: No such file or directory
sh: /usr/pgsql-9.3/bin/pg_config: No such file or directory
checking for libpq-fe.h... yes
checking for libpq/libpq-fs.h... yes
checking for pg_config_manual.h... yes
checking for PQconnectdb() in -lpq... yes
checking for PQsetSingleRowMode()... yes
checking for PQconninfo()... yes
checking for PQsslAttribute()... yes
checking for PQencryptPasswordConn()... yes
checking for timegm()... yes
checking for rb_gc_adjust_memory_usage()... yes
checking for PG_DIAG_TABLE_NAME in libpq-fe.h... yes
checking for unistd.h... yes
checking for inttypes.h... yes
checking for C99 variable length arrays... yes
creating extconf.h
creating Makefile

current directory: /Users/jun/dic/sample-app/vendor/bundle/ruby/2.6.0/gems/pg-1.1.4/ext
make "DESTDIR=" clean

current directory: /Users/jun/dic/sample-app/vendor/bundle/ruby/2.6.0/gems/pg-1.1.4/ext
make "DESTDIR="
compiling gvl_wrappers.c
compiling pg.c
compiling pg_binary_decoder.c
compiling pg_binary_encoder.c
compiling pg_coder.c
pg_coder.c:206:34: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
        res = this->dec_func(this, val, RSTRING_LEN(argv[0]), tuple, field, ENCODING_GET(argv[0]));
              ~~~~                      ^~~~~~~~~~~~~~~~~~~~
/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) & \
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
pg_coder.c:206:34: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
        res = this->dec_func(this, val, RSTRING_LEN(argv[0]), tuple, field, ENCODING_GET(argv[0]));
              ~~~~                      ^~~~~~~~~~~~~~~~~~~~
/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 pg_connection.c
compiling pg_copy_coder.c
pg_copy_coder.c:225:15: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
                                        strlen = RSTRING_LEN(subint);
                                               ~ ^~~~~~~~~~~~~~~~~~~
/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) & \
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
pg_copy_coder.c:225:15: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
                                        strlen = RSTRING_LEN(subint);
                                               ~ ^~~~~~~~~~~~~~~~~~~
/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)
     ~~~~~~~~~~~~~~~~~~~~~~^~~
pg_copy_coder.c:531:23: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
                input_len = end_ptr - start_ptr;
                          ~ ~~~~~~~~^~~~~~~~~~~
3 warnings generated.
compiling pg_errors.c
compiling pg_result.c
compiling pg_text_decoder.c
compiling pg_text_encoder.c
pg_text_encoder.c:170:14: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
                        len = out - start;
                            ~ ~~~~^~~~~~~
pg_text_encoder.c:289:15: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
                return optr - out;
                ~~~~~~ ~~~~~^~~~~
pg_text_encoder.c:293:12: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
                return 2 + RSTRING_LEN(*intermediate) * 2;
                ~~~~~~ ~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
pg_text_encoder.c:500:13: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
        nr_elems = RARRAY_LEN(value);
                 ~ ^~~~~~~~~~~~~~~~~
/Users/jun/.rbenv/versions/2.6.5/include/ruby-2.6.0/ruby/ruby.h:1058:23: note: expanded from macro 'RARRAY_LEN'
#define RARRAY_LEN(a) rb_array_len(a)
                      ^~~~~~~~~~~~~~~
4 warnings generated.
compiling pg_tuple.c
pg_tuple.c:475:15: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
        num_fields = RARRAY_LEN(values);
                   ~ ^~~~~~~~~~~~~~~~~~
/Users/jun/.rbenv/versions/2.6.5/include/ruby-2.6.0/ruby/ruby.h:1058:23: note: expanded from macro 'RARRAY_LEN'
#define RARRAY_LEN(a) rb_array_len(a)
                      ^~~~~~~~~~~~~~~
1 warning generated.
compiling pg_type_map.c
compiling pg_type_map_all_strings.c
compiling pg_type_map_by_class.c
compiling pg_type_map_by_column.c
pg_type_map_by_column.c:161:52: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
        return dec_func( p_coder, RSTRING_PTR(field_str), RSTRING_LEN(field_str), 0, fieldno, enc_idx );
               ~~~~~~~~                                   ^~~~~~~~~~~~~~~~~~~~~~
/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) & \
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
pg_type_map_by_column.c:161:52: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
        return dec_func( p_coder, RSTRING_PTR(field_str), RSTRING_LEN(field_str), 0, fieldno, enc_idx );
               ~~~~~~~~                                   ^~~~~~~~~~~~~~~~~~~~~~
/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)
     ~~~~~~~~~~~~~~~~~~~~~~^~~
pg_type_map_by_column.c:230:17: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
        conv_ary_len = RARRAY_LEN(conv_ary);
                     ~ ^~~~~~~~~~~~~~~~~~~~
/Users/jun/.rbenv/versions/2.6.5/include/ruby-2.6.0/ruby/ruby.h:1058:23: note: expanded from macro 'RARRAY_LEN'
#define RARRAY_LEN(a) rb_array_len(a)
                      ^~~~~~~~~~~~~~~
3 warnings generated.
compiling pg_type_map_by_mri_type.c
compiling pg_type_map_by_oid.c
compiling pg_type_map_in_ruby.c
compiling util.c
util.c:119:24: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
        return (char*)out_ptr - out;
        ~~~~~~ ~~~~~~~~~~~~~~~^~~~~
1 warning generated.
linking shared-object pg_ext.bundle
ld: file not found: dynamic_lookup
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [pg_ext.bundle] Error 1

make failed, exit code 2

Gem files will remain installed in /Users/jun/dic/sample-app/vendor/bundle/ruby/2.6.0/gems/pg-1.1.4 for inspection.
Results logged to /Users/jun/dic/sample-app/vendor/bundle/ruby/2.6.0/extensions/x86_64-darwin-18/2.6.0/pg-1.1.4/gem_make.out

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

In Gemfile:
  pg
MacBook-Pro-4:sample-app jun$ bundle config build.pg --use-system-libraries
You are replacing the current global value of build.pg, which is currently "--with-pg-config=/usr/pgsql-9.3/bin/pg_config"
MacBook-Pro-4:sample-app jun$ bundle config --local build.pg --use-system-libraries
You are replacing the current local value of build.pg, which is currently nil
MacBook-Pro-4:sample-app jun$ 
MacBook-Pro-4:sample-app jun$ 
MacBook-Pro-4:sample-app jun$ bundle config
Settings are listed in order of priority. The top value will be used.
path
Set for your local app (/Users/jun/dic/sample-app/.bundle/config): "vendor/bundle"
Set for the current user (/Users/jun/.bundle/config): "vendor/bundle"

gem.test
Set for the current user (/Users/jun/.bundle/config): false

gem.mit
Set for the current user (/Users/jun/.bundle/config): false

gem.coc
Set for the current user (/Users/jun/.bundle/config): false

build.pg
Set for your local app (/Users/jun/dic/sample-app/.bundle/config): "--use-system-libraries"
Set for the current user (/Users/jun/.bundle/config): "--use-system-libraries"

build.nokogiri
Set for the current user (/Users/jun/.bundle/config): "--use-system-libraries --with-xml2-include=/usr/local/opt/libxml2/include/libxml2"

MacBook-Pro-4:sample-app jun$ 
MacBook-Pro-4:sample-app jun$ 
MacBook-Pro-4:sample-app jun$ 
MacBook-Pro-4:sample-app jun$ 
MacBook-Pro-4:sample-app jun$ gem install pg -v '1.1.4' --source 'https://rubygems.org/'
Building native extensions. This could take a while...
Successfully installed pg-1.1.4
Parsing documentation for pg-1.1.4
Done installing documentation for pg after 1 seconds
1 gem installed
MacBook-Pro-4:sample-app jun$ bundle 
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/............
Fetching gem metadata from https://rubygems.org/.
Resolving dependencies...
Using rake 13.0.1
Using concurrent-ruby 1.1.5
Using i18n 1.7.0
Using minitest 5.13.0
Using thread_safe 0.3.6
Using tzinfo 1.2.5
Using activesupport 5.2.4
Using builder 3.2.4
Using erubi 1.9.0
Using mini_portile2 2.4.0
Using nokogiri 1.10.7
Using rails-dom-testing 2.0.3
Using crass 1.0.5
Using loofah 2.4.0
Using rails-html-sanitizer 1.3.0
Using actionview 5.2.4
Using rack 2.0.7
Using rack-test 1.1.0
Using actionpack 5.2.4
Using nio4r 2.5.2
Using websocket-extensions 0.1.4
Using websocket-driver 0.7.1
Using actioncable 5.2.4
Using globalid 0.4.2
Using activejob 5.2.4
Using mini_mime 1.0.2
Using mail 2.7.1
Using actionmailer 5.2.4
Using activemodel 5.2.4
Using arel 9.0.0
Using activerecord 5.2.4
Using mimemagic 0.3.3
Using marcel 0.3.3
Using activestorage 5.2.4
Using public_suffix 4.0.1
Using addressable 2.7.0
Using io-like 0.3.0
Using archive-zip 0.12.0
Using bindex 0.8.1
Using msgpack 1.3.1
Using bootsnap 1.4.5
Using bundler 2.0.2
Using byebug 11.0.1
Using regexp_parser 1.6.0
Using xpath 3.2.0
Using capybara 3.29.0
Using childprocess 3.0.0
Using chromedriver-helper 2.1.1
Using coffee-script-source 1.12.2
Using execjs 2.7.0
Using coffee-script 2.4.1
Using method_source 0.9.2
Using thor 1.0.0
Using railties 5.2.4
Using coffee-rails 4.2.2
Using ffi 1.11.3
Using jbuilder 2.9.1
Using rb-fsevent 0.10.3
Using rb-inotify 0.10.0
Using ruby_dep 1.5.0
Using listen 3.1.5
Fetching pg 1.1.4
Installing pg 1.1.4 with native extensions
Fetching puma 3.12.2
Installing puma 3.12.2 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 rails 5.2.4
Installing rails 5.2.4
Fetching rubyzip 2.0.0
Installing rubyzip 2.0.0
Fetching sass-listen 4.0.0
Installing sass-listen 4.0.0
Fetching sass 3.7.4
Installing sass 3.7.4
Fetching tilt 2.0.10
Installing tilt 2.0.10
Fetching sass-rails 5.1.0
Installing sass-rails 5.1.0
Fetching selenium-webdriver 3.142.6
Installing selenium-webdriver 3.142.6
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
Bundle complete! 18 Gemfile dependencies, 78 gems now installed.
Bundled gems are installed into `./vendor/bundle`
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

MacBook-Pro-4:sample-app jun$ 
MacBook-Pro-4:sample-app jun$ 
MacBook-Pro-4:sample-app jun$ bundle
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`.
Using rake 13.0.1
Using concurrent-ruby 1.1.5
Using i18n 1.7.0
Using minitest 5.13.0
Using thread_safe 0.3.6
Using tzinfo 1.2.5
Using activesupport 5.2.4
Using builder 3.2.4
Using erubi 1.9.0
Using mini_portile2 2.4.0
Using nokogiri 1.10.7
Using rails-dom-testing 2.0.3
Using crass 1.0.5
Using loofah 2.4.0
Using rails-html-sanitizer 1.3.0
Using actionview 5.2.4
Using rack 2.0.7
Using rack-test 1.1.0
Using actionpack 5.2.4
Using nio4r 2.5.2
Using websocket-extensions 0.1.4
Using websocket-driver 0.7.1
Using actioncable 5.2.4
Using globalid 0.4.2
Using activejob 5.2.4
Using mini_mime 1.0.2
Using mail 2.7.1
Using actionmailer 5.2.4
Using activemodel 5.2.4
Using arel 9.0.0
Using activerecord 5.2.4
Using mimemagic 0.3.3
Using marcel 0.3.3
Using activestorage 5.2.4
Using public_suffix 4.0.1
Using addressable 2.7.0
Using io-like 0.3.0
Using archive-zip 0.12.0
Using bindex 0.8.1
Using msgpack 1.3.1
Using bootsnap 1.4.5
Using bundler 2.0.2
Using byebug 11.0.1
Using regexp_parser 1.6.0
Using xpath 3.2.0
Using capybara 3.29.0
Using childprocess 3.0.0
Using chromedriver-helper 2.1.1
Using coffee-script-source 1.12.2
Using execjs 2.7.0
Using coffee-script 2.4.1
Using method_source 0.9.2
Using thor 1.0.0
Using railties 5.2.4
Using coffee-rails 4.2.2
Using ffi 1.11.3
Using jbuilder 2.9.1
Using rb-fsevent 0.10.3
Using rb-inotify 0.10.0
Using ruby_dep 1.5.0
Using listen 3.1.5
Using pg 1.1.4
Using puma 3.12.2
Using sprockets 3.7.2
Using sprockets-rails 3.2.1
Using rails 5.2.4
Using rubyzip 2.0.0
Using sass-listen 4.0.0
Using sass 3.7.4
Using tilt 2.0.10
Using sass-rails 5.1.0
Using selenium-webdriver 3.142.6
Using spring 2.1.0
Using spring-watcher-listen 2.0.1
Using turbolinks-source 5.2.0
Using turbolinks 5.2.1
Using uglifier 4.2.0
Using web-console 3.7.0
Bundle complete! 18 Gemfile dependencies, 78 gems now installed.
Bundled gems are installed into `./vendor/bundle`

```