2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Homebrew + rbenv + Bundler + dockerで開発環境をマネージドに構築する(前編)

Last updated at Posted at 2020-01-15

はじめに

システム

  • MacBookPro9,1
  • Intel Core i7 2.6 GHz
  • APPLE HDD HTS541075A9E682
  • DDR3 4GB 1.6GHz

構成

Tree-map
[Homebrew]
├─[formula]
│ ├─rbenv
│ ├─docker
│ └─...
│
└─[cask]
  └─docker

[Bundler]

brewコマンドリファレンス

セットアップ

Homebrew手順

1. Homebrewインストール
Terminal
$ brew --version
Homebrew 2.2.2
Homebrew/homebrew-core (git revision f246; last commit 2020-01-14)
Homebrew/homebrew-cask (git revision 7585; last commit 2020-01-15)

rbenv + Bundler手順

1. rbenvをインストール
Terminal
$ brew install rbenv ruby-build 
Updating Homebrew...
==> Installing dependencies for rbenv: autoconf, pkg-config, readline and ruby-build
==> Installing rbenv dependency: autoconf
==> Downloading https://homebrew.bintray.com/bottles/autoconf-2.69.mojave.bottle.4.tar.gz
==> Downloading from https://akamai.bintray.com/97/9724736d34773b6e41e2434ffa28fe79feccccf7b7786e54671441ca75115cdb?__gda__=exp=157912005
######################################################################## 100.0%
==> Pouring autoconf-2.69.mojave.bottle.4.tar.gz
==> Caveats
Emacs Lisp files have been installed to:
  /usr/local/share/emacs/site-lisp/autoconf
==> Summary
🍺  /usr/local/Cellar/autoconf/2.69: 71 files, 3.0MB
==> Installing rbenv dependency: pkg-config
==> Downloading https://homebrew.bintray.com/bottles/pkg-config-0.29.2.mojave.bottle.1.tar.gz
==> Downloading from https://akamai.bintray.com/dc/dcfcba723621eee085ddd5ebadc41fb8787a4717b9686f5288281633a830ac5e?__gda__=exp=157912007
######################################################################## 100.0%
==> Pouring pkg-config-0.29.2.mojave.bottle.1.tar.gz
🍺  /usr/local/Cellar/pkg-config/0.29.2: 11 files, 626.9KB
==> Installing rbenv dependency: readline
==> Downloading https://homebrew.bintray.com/bottles/readline-8.0.1.mojave.bottle.tar.gz
==> Downloading from https://akamai.bintray.com/3c/3c754391e9d243835811d128771ca0f1a565024100fd2c2871534353d46aaf0e?__gda__=exp=157912007
######################################################################## 100.0%
==> Pouring readline-8.0.1.mojave.bottle.tar.gz
==> Caveats
readline is keg-only, which means it was not symlinked into /usr/local,
because macOS provides the BSD libedit library, which shadows libreadline.
In order to prevent conflicts when programs look for libreadline we are
defaulting this GNU Readline installation to keg-only.

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

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

==> Summary
🍺  /usr/local/Cellar/readline/8.0.1: 48 files, 1.5MB
==> Installing rbenv dependency: ruby-build
==> Downloading https://github.com/rbenv/ruby-build/archive/v20191225.tar.gz
==> Downloading from https://codeload.github.com/rbenv/ruby-build/tar.gz/v20191225
######################################################################## 100.0%
==> ./install.sh
==> Caveats
ruby-build installs a non-Homebrew OpenSSL for each Ruby version installed and these are never upgraded.

To link Rubies to Homebrew's OpenSSL 1.1 (which is upgraded) add the following
to your ~/.bash_profile:
  export RUBY_CONFIGURE_OPTS="--with-openssl-dir=$(brew --prefix openssl@1.1)"

Note: this may interfere with building old versions of Ruby (e.g <2.4) that use
OpenSSL <1.1.
==> Summary
🍺  /usr/local/Cellar/ruby-build/20191225: 467 files, 232.9KB, built in 9 seconds
==> Installing rbenv
==> Downloading https://homebrew.bintray.com/bottles/rbenv-1.1.2.mojave.bottle.tar.gz
######################################################################## 100.0%
==> Pouring rbenv-1.1.2.mojave.bottle.tar.gz
🍺  /usr/local/Cellar/rbenv/1.1.2: 36 files, 65KB
==> Caveats
==> autoconf
Emacs Lisp files have been installed to:
  /usr/local/share/emacs/site-lisp/autoconf
==> readline
readline is keg-only, which means it was not symlinked into /usr/local,
because macOS provides the BSD libedit library, which shadows libreadline.
In order to prevent conflicts when programs look for libreadline we are
defaulting this GNU Readline installation to keg-only.

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

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

==> ruby-build
ruby-build installs a non-Homebrew OpenSSL for each Ruby version installed and these are never upgraded.

To link Rubies to Homebrew's OpenSSL 1.1 (which is upgraded) add the following
to your ~/.bash_profile:
  export RUBY_CONFIGURE_OPTS="--with-openssl-dir=$(brew --prefix openssl@1.1)"

Note: this may interfere with building old versions of Ruby (e.g <2.4) that use
OpenSSL <1.1.
後編の bundle installで ld: library not found for -lmysqlclientが出る場合
  • mysql-clientをbrew installする
  • 今回は便宜上mysql本体もインストールします
Terminal
$ brew install mysql@5.7 mysql-client
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 2 taps (homebrew/core and homebrew/cask).
==> Updated Formulae
ask-cli              cppunit              firebase-cli         grafana              kepubify             nss                  swagger-codegen      vnstat
balena-cli           exploitdb            gatsby-cli           homebank             kubernetes-cli       pnetcdf              swiftformat          wireshark
bandwhich            fastmod              gnu-sed              jetty                nnn                  sk                   triton

==> Installing dependencies for mysql@5.7: openssl@1.1
==> Installing mysql@5.7 dependency: openssl@1.1
==> Downloading https://homebrew.bintray.com/bottles/openssl@1.1-1.1.1d.mojave.bottle.tar.gz
==> Downloading from https://akamai.bintray.com/10/104ef018b7bb8fcc49f57e5a60359a28a02d480d85a959e6141394b0571cbb28?__gda__=exp=1579158856~hmac=a9efd8d394c8395a239164f6
######################################################################## 100.0%
==> Pouring openssl@1.1-1.1.1d.mojave.bottle.tar.gz
==> 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"

==> Summary
🍺  /usr/local/Cellar/openssl@1.1/1.1.1d: 7,983 files, 17.9MB
==> Installing mysql@5.7
==> Downloading https://homebrew.bintray.com/bottles/mysql@5.7-5.7.29.mojave.bottle.tar.gz
==> Downloading from https://akamai.bintray.com/88/88cf1f9f07a84694654f790507da937909eee1b16a0e47d473b2fc45e19c9ec1?__gda__=exp=1579158876~hmac=aded53b411d68f102730593c
######################################################################## 100.0%
==> Pouring mysql@5.7-5.7.29.mojave.bottle.tar.gz
==> /usr/local/Cellar/mysql@5.7/5.7.29/bin/mysqld --initialize-insecure --user=webmaster-patche --basedir=/usr/local/Cellar/mysql@5.7/5.7.29 --datadir=/usr/local/var/my
==> 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

mysql@5.7 is keg-only, which means it was not symlinked into /usr/local,
because this is an alternate version of another formula.

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

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

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


To have launchd start mysql@5.7 now and restart at login:
  brew services start mysql@5.7
Or, if you don't want/need a background service you can just run:
  /usr/local/opt/mysql@5.7/bin/mysql.server start
==> Summary
🍺  /usr/local/Cellar/mysql@5.7/5.7.29: 319 files, 232MB
==> Downloading https://homebrew.bintray.com/bottles/mysql-client-8.0.18.mojave.bottle.tar.gz
==> Downloading from https://akamai.bintray.com/97/9729c80a49ac7b808bbc26a93130c3ea16797da3824ed9450df53974958de066?__gda__=exp=1579158956~hmac=1875d3c653a83978e85b9a4d
######################################################################## 100.0%
==> Pouring mysql-client-8.0.18.mojave.bottle.tar.gz
==> Caveats
mysql-client is keg-only, which means it was not symlinked into /usr/local,
because it conflicts with mysql (which contains client libraries).

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

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

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

==> Summary
🍺  /usr/local/Cellar/mysql-client/8.0.18: 127 files, 137.6MB
==> Caveats
==> openssl@1.1
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"

==> mysql@5.7
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

mysql@5.7 is keg-only, which means it was not symlinked into /usr/local,
because this is an alternate version of another formula.

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

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

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


To have launchd start mysql@5.7 now and restart at login:
  brew services start mysql@5.7
Or, if you don't want/need a background service you can just run:
  /usr/local/opt/mysql@5.7/bin/mysql.server start
==> mysql-client
mysql-client is keg-only, which means it was not symlinked into /usr/local,
because it conflicts with mysql (which contains client libraries).

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

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

For pkg-config to find mysql-client you may need to set:
  export PKG_CONFIG_PATH="/usr/local/opt/mysql-client/lib/pkgconfig"
それでもmysql client is missing. You may need to 'brew install mysql' or 'port install mysql', and try again.が出る場合
Terminal
checking for rb_absint_size()... yes
checking for rb_absint_singlebit_p()... yes
checking for rb_wait_for_single_fd()... yes
checking for -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/webmaster-patche/.rbenv/versions/2.6.5/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/webmaster-patche/capistrano_sample_app_v1/vendor/bundle/ruby/2.6.0/extensions/x86_64-darwin-18/2.6.0/mysql2-0.5.3/mkmf.log

extconf failed, exit code 1

brew install時のログの以下の箇所が原因と考えられます

Terminal
mysql@5.7 is keg-only, which means it was not symlinked into /usr/local

PATHを通すことで解決します

Terminal
$ echo 'export PATH="/usr/local/opt/mysql@5.7/bin:$PATH"' >> ~/.bash_profile

$ source ~/.bash_profile 

疎通確認します

Terminal
$ mysql -uroot
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.29 Homebrew

Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> quit
さらに Don't know how to set rpath on your system, if MySQL libraries are not in path mysql2 may not loadが出る場合(👈くどい)
Terminal
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"

これを元に後編のbundle install にて、bundle configを設定しておいてください

Terminal
$ bundle config --local build.mysql2 "--with-ldflags=-L/usr/local/opt/openssl@1.1/lib --with-cppflags=-I/usr/local/opt/openssl@1.1/include"
2. rbenvのバージョンを確認
Terminal
webmaster-patche-no-MacBook-Pro:~ webmaster-patche$ rbenv --version
rbenv 1.1.2
3. インストール可能なバージョン一覧表示
Terminal
webmaster-patche-no-MacBook-Pro:~ webmaster-patche$ rbenv install -l
...省略...
2.5.0-dev
2.5.0-preview1
2.5.0-rc1
2.5.0
2.5.1
2.5.2
2.5.3
2.5.4
2.5.5
2.5.6
2.5.7
2.6.0-dev
2.6.0-preview1
2.6.0-preview2
2.6.0-preview3
2.6.0-rc1
2.6.0-rc2
2.6.0
2.6.1
2.6.2
2.6.3
2.6.4
2.6.5
2.7.0-dev
2.7.0-preview1
2.7.0-preview2
2.7.0-preview3
2.7.0-rc1
2.7.0-rc2
2.7.0
jruby-1.5.6
jruby-1.6.3
jruby-1.6.4
jruby-1.6.5
jruby-1.6.5.1
jruby-1.6.6
jruby-1.6.7
jruby-1.6.7.2
jruby-1.6.8
jruby-1.7.0-preview1
jruby-1.7.0-preview2
jruby-1.7.0-rc1
jruby-1.7.0-rc2
jruby-1.7.0
jruby-1.7.1
jruby-1.7.2
jruby-1.7.3
jruby-1.7.4
jruby-1.7.5
jruby-1.7.6
jruby-1.7.7
jruby-1.7.8
jruby-1.7.9
jruby-1.7.10
jruby-1.7.11
jruby-1.7.12
jruby-1.7.13
jruby-1.7.14
jruby-1.7.15
jruby-1.7.16
jruby-1.7.16.1
jruby-1.7.16.2
jruby-1.7.17
jruby-1.7.18
jruby-1.7.19
jruby-1.7.20
jruby-1.7.20.1
jruby-1.7.21
jruby-1.7.22
jruby-1.7.23
jruby-1.7.24
jruby-1.7.25
jruby-1.7.26
jruby-1.7.27
jruby-9.0.0.0.pre1
jruby-9.0.0.0.pre2
jruby-9.0.0.0.rc1
jruby-9.0.0.0.rc2
jruby-9.0.0.0
jruby-9.0.1.0
jruby-9.0.3.0
jruby-9.0.4.0
jruby-9.0.5.0
jruby-9.1.0.0-dev
jruby-9.1.0.0
jruby-9.1.1.0
jruby-9.1.2.0
jruby-9.1.3.0
jruby-9.1.4.0
jruby-9.1.5.0
jruby-9.1.6.0
jruby-9.1.7.0
jruby-9.1.8.0
jruby-9.1.9.0
jruby-9.1.10.0
jruby-9.1.11.0
jruby-9.1.12.0
jruby-9.1.13.0
jruby-9.1.14.0
jruby-9.1.15.0
jruby-9.1.16.0
jruby-9.1.17.0
jruby-9.2.0.0-dev
jruby-9.2.0.0
jruby-9.2.1.0-dev
jruby-9.2.1.0
jruby-9.2.3.0
jruby-9.2.4.0
jruby-9.2.4.1
jruby-9.2.5.0
jruby-9.2.6.0
jruby-9.2.7.0
jruby-9.2.8.0
jruby-9.2.9.0
maglev-1.0.0
maglev-1.1.0-dev
maglev-2.0.0-dev
mruby-dev
mruby-1.0.0
mruby-1.1.0
mruby-1.2.0
mruby-1.3.0
mruby-1.4.0
mruby-1.4.1
mruby-2.0.0
mruby-2.0.1
mruby-2.1.0
rbx-2.2.2
rbx-2.2.3
rbx-2.2.4
rbx-2.2.5
rbx-2.2.6
rbx-2.2.7
rbx-2.2.8
rbx-2.2.9
rbx-2.2.10
rbx-2.3.0
rbx-2.4.0
rbx-2.4.1
rbx-2.5.0
rbx-2.5.1
rbx-2.5.2
rbx-2.5.3
rbx-2.5.4
rbx-2.5.5
rbx-2.5.6
rbx-2.5.7
rbx-2.5.8
rbx-2.6
rbx-2.7
rbx-2.8
rbx-2.9
rbx-2.10
rbx-2.11
rbx-2.71828182
rbx-3.0
rbx-3.1
rbx-3.2
rbx-3.3
rbx-3.4
rbx-3.5
rbx-3.6
rbx-3.7
rbx-3.8
rbx-3.9
rbx-3.10
rbx-3.11
rbx-3.12
rbx-3.13
rbx-3.14
rbx-3.15
rbx-3.16
rbx-3.17
rbx-3.18
rbx-3.19
rbx-3.20
rbx-3.21
rbx-3.22
rbx-3.23
rbx-3.24
rbx-3.25
rbx-3.26
rbx-3.27
rbx-3.28
rbx-3.29
rbx-3.30
rbx-3.31
rbx-3.32
rbx-3.33
rbx-3.34
rbx-3.35
rbx-3.36
rbx-3.37
rbx-3.38
rbx-3.39
rbx-3.40
rbx-3.41
rbx-3.42
rbx-3.43
rbx-3.44
rbx-3.45
rbx-3.46
rbx-3.47
rbx-3.48
rbx-3.49
rbx-3.50
rbx-3.51
rbx-3.52
rbx-3.53
rbx-3.54
rbx-3.55
rbx-3.56
rbx-3.57
rbx-3.58
rbx-3.59
rbx-3.60
rbx-3.61
rbx-3.62
rbx-3.63
rbx-3.64
rbx-3.65
rbx-3.66
rbx-3.67
rbx-3.68
rbx-3.69
rbx-3.70
rbx-3.71
rbx-3.72
rbx-3.73
rbx-3.74
rbx-3.75
rbx-3.76
rbx-3.77
rbx-3.78
rbx-3.79
rbx-3.80
rbx-3.81
rbx-3.82
rbx-3.83
rbx-3.84
rbx-3.85
rbx-3.86
rbx-3.87
rbx-3.88
rbx-3.89
rbx-3.90
rbx-3.91
rbx-3.92
rbx-3.93
rbx-3.94
rbx-3.95
rbx-3.96
rbx-3.97
rbx-3.98
rbx-3.99
rbx-3.100
rbx-3.101
rbx-3.102
rbx-3.103
rbx-3.104
rbx-3.105
rbx-3.106
rbx-3.107
ree-1.8.7-2011.03
ree-1.8.7-2011.12
ree-1.8.7-2012.01
ree-1.8.7-2012.02
topaz-dev
truffleruby-1.0.0-rc10
truffleruby-1.0.0-rc11
truffleruby-1.0.0-rc12
truffleruby-1.0.0-rc13
truffleruby-1.0.0-rc14
truffleruby-1.0.0-rc15
truffleruby-1.0.0-rc16
truffleruby-1.0.0-rc2
truffleruby-1.0.0-rc3
truffleruby-1.0.0-rc5
truffleruby-1.0.0-rc6
truffleruby-1.0.0-rc7
truffleruby-1.0.0-rc8
truffleruby-1.0.0-rc9
truffleruby-19.0.0
truffleruby-19.1.0
truffleruby-19.2.0
truffleruby-19.2.0.1
truffleruby-19.3.0
4. インストール
Terminal
$ rbenv install 2.6.5
Downloading openssl-1.1.1d.tar.gz...
-> https://dqw8nmjcqpjn7.cloudfront.net/1e3a91bc1f9dfce01af26026f856e064eab4c8ee0a8f457b5ae30b40b8b711f2
Installing openssl-1.1.1d...
Installed openssl-1.1.1d to /Users/webmaster-patche/.rbenv/versions/2.6.5

Downloading ruby-2.6.5.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/2.6/ruby-2.6.5.tar.bz2
Installing ruby-2.6.5...
ruby-build: using readline from homebrew
Installed ruby-2.6.5 to /Users/webmaster-patche/.rbenv/versions/2.6.5
5. rbenvで認識しているすべてのRubyバージョンを一覧表示
Terminal
$ rbenv versions
* system (set by /Users/webmaster-patche/.rbenv/version)
  2.6.5

systemはMacに最初から入っているRubyを意味します

6. globalのRubyバージョンを変更
Terminal
$ rbenv global 2.6.5

$ rbenv versions
  system
* 2.6.5 (set by /Users/webmaster-patche/.rbenv/version)
7. rbenv init
Terminal
$ rbenv init
# Load rbenv automatically by appending
# the following to ~/.bash_profile:

eval "$(rbenv init -)"
8. プロファイルにinitを追記
Terminal
echo 'export PATH="~/.rbenv/shims:/usr/local/bin:$PATH"' >>  ~/.bash_profile
echo 'eval "$(rbenv init --no-rehash -)"' >>  ~/.bash_profile

$ source ~/.bash_profile

*尚、 7〜8の手順をしないと、 You don't have write permissions が発生します

Terminal
$ gem install bundler
ERROR:  While executing gem ... (Gem::FilePermissionError)
    You don't have write permissions for the /Library/Ruby/Gems/2.3.0 directory.
9. bundlerのインストール
Terminal
$ gem list bundler --remote

*** REMOTE GEMS ***

appbundler (0.13.1)
asset_bundler (0.2.0)
atd-asset_bundler (0.0.3)
bonnie_bundler (2.2.5)
bowline-bundler (0.0.4)
bundler (2.1.4)
bundler-add (0.0.1)
bundler-advise (1.2.0)
bundler-audit (0.6.1)
bundler-audited_update (0.1.5)
bundler-auto-update (0.1.0)
bundler-bootstrap (0.0.3)
bundler-bouncer (0.1.2)
bundler-bower (0.0.3)
bundler-budit (0.6.3)
bundler-changelog (0.0.0)
...省略...

$ gem install bundler
Fetching bundler-2.1.4.gem
Successfully installed bundler-2.1.4
Parsing documentation for bundler-2.1.4
Installing ri documentation for bundler-2.1.4
Done installing documentation for bundler after 4 seconds
1 gem installed

$ rbenv rehash
10. bundlerのバージョンの確認
Terminal
$ bundler -v
Bundler version 2.1.4

Docker手順

1. Brew経由でインストール
Terminal
$ brew install docker
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/cask).
No changes to formulae.

==> Downloading https://homebrew.bintray.com/bottles/docker-19.03.5.mojave.bottle.tar.gz
==> Downloading from https://akamai.bintray.com/99/99bfeaa39dfe7b1ee02bbe37b7433176d7f17266575bfa565ca94e0f1a3d204d?__gda__=exp=157912477
######################################################################## 100.0%
==> Pouring docker-19.03.5.mojave.bottle.tar.gz
==> Caveats
Bash completion has been installed to:
  /usr/local/etc/bash_completion.d

zsh completions have been installed to:
  /usr/local/share/zsh/site-functions
==> Summary
🍺  /usr/local/Cellar/docker/19.03.5: 14 files, 75.8MB

$ brew cask install docker
==> Downloading https://download.docker.com/mac/stable/40693/Docker.dmg
######################################################################## 100.0%
==> Verifying SHA-256 checksum for Cask 'docker'.
==> Installing Cask docker
==> Moving App 'Docker.app' to '/Applications/Docker.app'.
🍺  docker was successfully installed!
2. バージョン確認
Terminal
$ docker --version
Docker version 19.03.5, build 633a0ea
3. 起動確認
Terminal
$ open /Applications/Docker.app
4. アクセス権付与

スクリーンショット 2020-01-16 6.43.00.png

ログインユーザーのパスワード要求がされます

スクリーンショット 2020-01-16 6.43.31.png

パスワード入力後、ボタンに文言がありませんが(汗 クリックします

スクリーンショット 2020-01-16 6.44.02.png

起動しました

5. セットアップ

スクリーンショット 2020-01-16 6.46.36.png
スクリーンショット 2020-01-16 7.02.06.png

まずは Reset to factory defaults で rawフォーマットを行う

スクリーンショット 2020-01-16 7.03.08.png

再起動します。この際に、権限付与のダイアログが表示されます

スクリーンショット 2020-01-16 7.05.22.png

ただ、 Disk の情報を見る限り、デフォルトでrawフォーマットになっていると考えられる
リリースノートを見る限りでは、rawフォーマットについては2018年以降、記述がありません

6. メンテナンス

スクリーンショット 2020-01-16 7.05.22.png

(*GB on disk) がDisk image sizeに限りなく近くなった場合、build時のゴミなどが溜まってきている可能性が高い

スクリーンショット 2020-01-16 7.02.06.png

定期的に Reset disk image する必要がありますが、再度、ビルドし直しとなります。

後編〜に続く

2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?