Rubyに紐づくgem?
バージョン管理って何それっていう初心者エンジニアの方向けに書いてみた。
紐づくという言い方が適当かはわからないけど、gem install
とか、オプションなしでbundle install
とかやるとRubyのバージョンを変更するたびにgemのバージョンが変わっていることを確認できる。
特にrvm
やrbenv
をなぜ使っているのかわかっていないときに教材で習った通りにコマンドを実行していて出くわすことが多いかも。
初めは僕もなぜそうなるのかわからなかったが、これはgemというのは普通はRubyに紐づいていているからだ(表現的に正しいかはわからないけど)。
つまりそのとき使ってるバージョンのRubyの配下にgemsがインストールされるということ。
プロジェクトごとに特定のバージョンのRubyやgemをインストールするにはお作法がある。
今回はすでに特定のRubyのバージョンにインストールされているgemをアンインストールしてきれいにしてしまいたい。
すでに長くなりそうだけど、さらっと理解してほしい。
Rubyのバージョンを確認する
まずは自分が今使っているRubyのバージョンを把握しておく。
vagrant@ubuntu-xenial:~/tmp$ ruby -v
ruby 2.5.0p0 (2017-12-25 revision 61468) [x86_64-linux]
gem(それ自体)のバージョンを確認する
まぁ別にやる意味はないけど一応。
vagrant@ubuntu-xenial:~/project$ gem -v
2.7.7
各gemのバージョンを確認する
続いてRubyに紐づく各gemのバージョンを確認する。
vagrant@ubuntu-xenial:~/tmp$ gem list
*** LOCAL GEMS ***
actioncable (5.1.6, 5.1.4)
actionmailer (5.1.6, 5.1.4)
actionpack (5.1.6, 5.1.4)
actionview (5.1.6, 5.1.4)
activejob (5.1.6, 5.1.4)
activemodel (5.1.6, 5.1.4)
activerecord (5.1.6, 5.1.4)
activesupport (5.1.6, 5.1.4)
addressable (2.5.2)
ansi (1.5.0)
arel (8.0.0)
autoprefixer-rails (9.1.4, 8.6.5)
bcrypt (3.1.12, 3.1.11)
bigdecimal (default: 1.3.4)
bindex (0.5.0)
bootstrap-sass (3.3.7)
bootstrap-will_paginate (1.0.0)
builder (3.2.3)
bundler (default: 1.16.2)
byebug (10.0.2, 9.0.6)
capybara (2.18.0)
carrierwave (1.2.2)
CFPropertyList (2.3.6)
childprocess (0.9.0)
cmath (default: 1.0.0)
coderay (1.1.2)
coffee-rails (4.2.2)
coffee-script (2.4.1)
coffee-script-source (1.12.2)
concurrent-ruby (1.0.5)
crass (1.0.4)
csv (default: 1.0.0)
database_cleaner (1.7.0)
date (default: 1.0.0)
dbm (default: 1.0.0)
diff-lcs (1.3)
domain_name (0.5.20180417)
dry-inflector (0.1.2)
erubi (1.7.1)
etc (default: 1.0.0)
excon (0.62.0)
execjs (2.7.0)
factory_girl (4.9.0)
factory_girl_rails (4.9.0)
faker (1.9.1, 1.7.3)
fcntl (default: 1.0.0)
ffi (1.9.25)
fiddle (default: 1.0.0)
fileutils (default: 1.0.2)
fission (0.5.0)
fog-aliyun (0.3.2)
fog-atmos (0.1.0)
fog-aws (2.0.1)
fog-brightbox (0.16.1)
fog-cloudatcost (0.1.2)
fog-core (1.45.0)
fog-digitalocean (0.4.0)
fog-dnsimple (1.0.0)
fog-dynect (0.0.3)
fog-ecloud (0.3.0)
fog-google (0.1.0)
fog-internet-archive (0.0.1)
fog-joyent (0.0.1)
fog-json (1.2.0)
fog-local (0.6.0)
fog-openstack (0.3.6)
fog-xml (0.1.3)
formatador (0.2.5)
gdbm (default: 2.0.0)
globalid (0.4.1)
guard (2.13.0)
guard-compat (1.2.1)
guard-minitest (2.4.4)
i18n (1.1.1, 1.1.0, 1.0.1, 0.9.5)
io-console (default: 0.4.6)
ipaddr (default: 1.2.0)
ipaddress (0.8.3)
jbuilder (2.7.0)
jquery-rails (4.3.1)
json (default: 2.1.0)
libv8 (3.16.14.19 x86_64-linux)
listen (3.1.5)
loofah (2.2.2)
lumberjack (1.0.13)
mail (2.7.1, 2.7.0)
method_source (0.9.0)
mime-types (3.2.2)
mime-types-data (3.2018.0812)
mini_mime (1.0.1, 1.0.0)
mini_portile2 (2.3.0)
minitest (5.11.3, 5.10.3)
minitest-reporters (1.1.14)
multi_json (1.13.1)
nenv (0.3.0)
nio4r (2.3.1)
nokogiri (1.8.5, 1.8.4)
notiffany (0.1.1)
openssl (default: 2.1.0)
pry (0.11.3)
psych (default: 3.0.2)
public_suffix (3.0.3, 3.0.2)
puma (3.12.0, 3.9.1)
rack (2.0.5)
rack-mini-profiler (1.0.2)
rack-test (1.1.0, 1.0.0)
rails (5.1.6, 5.1.4)
rails-controller-testing (1.0.2)
rails-dom-testing (2.0.3)
rails-html-sanitizer (1.0.4)
railties (5.1.6, 5.1.4)
rake (12.3.1)
rb-fsevent (0.10.3)
rb-inotify (0.9.10)
rdoc (default: 6.0.1)
ref (2.0.0)
rspec-core (3.7.1)
rspec-expectations (3.7.0)
rspec-mocks (3.7.0)
rspec-rails (3.7.2)
rspec-support (3.7.1)
ruby-progressbar (1.9.0)
ruby_dep (1.5.0)
rubygems-update (2.7.7)
rubyzip (1.2.2, 1.2.1)
sass (3.6.0, 3.5.7, 3.5.6)
sass-listen (4.0.0)
sass-rails (5.0.7, 5.0.6)
scanf (default: 1.0.0)
sdbm (default: 1.0.0)
selenium-webdriver (3.14.1, 3.14.0, 3.13.1)
shellany (0.0.1)
shoulda-matchers (3.1.2)
spring (2.0.2)
spring-watcher-listen (2.0.1)
sprockets (3.7.2)
sprockets-rails (3.2.1)
sqlite3 (1.3.13)
stringio (default: 0.0.1)
strscan (default: 1.0.0)
therubyracer (0.12.3)
thor (0.20.0)
thread_safe (0.3.6)
tilt (2.0.8)
turbolinks (5.2.0, 5.1.1, 5.0.1)
turbolinks-source (5.2.0, 5.1.0)
tzinfo (1.2.5)
uglifier (4.1.19, 4.1.18, 4.1.16, 4.1.15, 3.2.0)
unf (0.1.4)
unf_ext (0.0.7.5)
web-console (3.7.0, 3.6.2, 3.5.1)
webrick (default: 1.4.2)
websocket-driver (0.6.5)
websocket-extensions (0.1.3)
will_paginate (3.1.6)
xml-simple (1.1.5)
xpath (3.2.0, 3.1.0)
zlib (default: 1.0.0)
一つのgemなのに複数のバージョンがインストールされているのでこれらをきれいにしたい。
単に一つにまとめるだけなら以下でもOK
[Ruby] gem list で複数バージョン表示される場合は gem cleanup する
gem cleanup
rubyのパスを確認する
vagrant@ubuntu-xenial:~/tmp$ which ruby
/home/vagrant/.rbenv/shims/ruby
Macとかのシステム標準のRubyの場合、このRubyのパスの配下にgemが入っているので物理で殴りに行こうと思ったが、rbenvの場合うまい具合にラッピングされていたのでここで悩んでしまった。
なのでgemのパスをググって調べた。
念の為、バージョン管理されているRubyの一覧を確認しておく。
vagrant@ubuntu-xenial:~/tmp$ rbenv versions
2.4.1
* 2.5.0 (set by /home/vagrant/.rbenv/version)
2.5.1
gemのパスを確認する
以下を参考にしてgemのパスを確認する。
Rubyが参照してるgemのパスやインストール済gemを確認する方法
vagrant@ubuntu-xenial:~/tmp$ gem environment
RubyGems Environment:
- RUBYGEMS VERSION: 2.7.7
- RUBY VERSION: 2.5.0 (2017-12-25 patchlevel 0) [x86_64-linux]
- INSTALLATION DIRECTORY: /home/vagrant/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0
- USER INSTALLATION DIRECTORY: /home/vagrant/.gem/ruby/2.5.0
- RUBY EXECUTABLE: /home/vagrant/.rbenv/versions/2.5.0/bin/ruby
- EXECUTABLE DIRECTORY: /home/vagrant/.rbenv/versions/2.5.0/bin
- SPEC CACHE DIRECTORY: /home/vagrant/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: /home/vagrant/.rbenv/versions/2.5.0/etc
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-linux
- GEM PATHS:
- /home/vagrant/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0
- /home/vagrant/.gem/ruby/2.5.0
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- "install" => "--no-ri --no-rdoc"
- "update" => "--no-ri --no-rdoc"
- REMOTE SOURCES:
- https://rubygems.org/
- SHELL PATH:
- /home/vagrant/.rbenv/versions/2.5.0/bin
- /home/vagrant/.rbenv/libexec
- /home/vagrant/.rbenv/plugins/ruby-build/bin
- /home/vagrant/bin
- /home/vagrant/.local/bin
- /home/vagrant/.anyenv/envs/pyenv/shims
- /home/vagrant/.anyenv/envs/pyenv/bin
- /home/vagrant/.anyenv/bin
- /home/vagrant/.pyenv/bin
- /home/vagrant/.rbenv/shims
- /home/vagrant/.rbenv/bin
- /usr/local/sbin
- /usr/local/bin
- /usr/sbin
- /usr/bin
- /sbin
- /bin
- /usr/games
- /usr/local/games
- /snap/bin
実はRubyのバージョンとか書いてあった・・・
/home/vagrant/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0
このパスが実際にruby-2.5.0に紐づいているgemのパスとなっている。
実際に確認してみる。
vagrant@ubuntu-xenial:~/tmp$ ls -la /home/vagrant/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0
total 56
drwxr-xr-x 8 vagrant vagrant 4096 Mar 11 23:27 .
drwxr-xr-x 3 vagrant vagrant 4096 Jul 7 2018 ..
drwxr-xr-x 2 vagrant vagrant 4096 Jul 7 2018 build_info
drwxr-xr-x 2 vagrant vagrant 12288 Mar 11 23:27 cache
drwxr-xr-x 2 vagrant vagrant 4096 Jul 7 2018 doc
drwxr-xr-x 3 vagrant vagrant 4096 Jul 7 2018 extensions
drwxr-xr-x 179 vagrant vagrant 12288 Mar 11 23:27 gems
drwxr-xr-x 3 vagrant vagrant 12288 Mar 11 23:27 specifications
vagrant@ubuntu-xenial:~/tmp$ ls -la /home/vagrant/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/
total 724
drwxr-xr-x 179 vagrant vagrant 12288 Mar 11 23:27 .
drwxr-xr-x 8 vagrant vagrant 4096 Mar 11 23:27 ..
drwxrwxr-x 3 vagrant vagrant 4096 Jul 18 2018 actioncable-5.1.4
drwxrwxr-x 3 vagrant vagrant 4096 Jul 16 2018 actioncable-5.1.6
drwxrwxr-x 3 vagrant vagrant 4096 Jul 18 2018 actionmailer-5.1.4
drwxrwxr-x 3 vagrant vagrant 4096 Jul 16 2018 actionmailer-5.1.6
drwxrwxr-x 3 vagrant vagrant 4096 Jul 18 2018 actionpack-5.1.4
drwxrwxr-x 3 vagrant vagrant 4096 Jul 16 2018 actionpack-5.1.6
drwxrwxr-x 3 vagrant vagrant 4096 Jul 18 2018 actionview-5.1.4
drwxrwxr-x 3 vagrant vagrant 4096 Jul 16 2018 actionview-5.1.6
drwxrwxr-x 3 vagrant vagrant 4096 Jul 18 2018 activejob-5.1.4
drwxrwxr-x 3 vagrant vagrant 4096 Jul 16 2018 activejob-5.1.6
drwxrwxr-x 3 vagrant vagrant 4096 Jul 18 2018 activemodel-5.1.4
drwxrwxr-x 3 vagrant vagrant 4096 Jul 16 2018 activemodel-5.1.6
drwxrwxr-x 4 vagrant vagrant 4096 Jul 18 2018 activerecord-5.1.4
drwxrwxr-x 4 vagrant vagrant 4096 Jul 16 2018 activerecord-5.1.6
drwxrwxr-x 3 vagrant vagrant 4096 Jul 18 2018 activesupport-5.1.4
drwxrwxr-x 3 vagrant vagrant 4096 Jul 16 2018 activesupport-5.1.6
drwxrwxr-x 6 vagrant vagrant 4096 Jul 22 2018 addressable-2.5.2
drwxrwxr-x 5 vagrant vagrant 4096 Jul 18 2018 ansi-1.5.0
drwxrwxr-x 3 vagrant vagrant 4096 Jul 16 2018 arel-8.0.0
drwxrwxr-x 5 vagrant vagrant 4096 Jul 18 2018 autoprefixer-rails-8.6.5
drwxrwxr-x 5 vagrant vagrant 4096 Mar 2 15:26 autoprefixer-rails-9.1.4
drwxrwxr-x 5 vagrant vagrant 4096 Jul 18 2018 bcrypt-3.1.11
drwxrwxr-x 5 vagrant vagrant 4096 Mar 2 15:26 bcrypt-3.1.12
drwxrwxr-x 5 vagrant vagrant 4096 Jul 18 2018 bindex-0.5.0
drwxrwxr-x 7 vagrant vagrant 4096 Jul 18 2018 bootstrap-sass-3.3.7
drwxrwxr-x 4 vagrant vagrant 4096 Mar 2 15:26 bootstrap-will_paginate-1.0.0
drwxrwxr-x 6 vagrant vagrant 4096 Jul 16 2018 builder-3.2.3
drwxrwxr-x 3 vagrant vagrant 4096 Jul 16 2018 bundler-1.16.2
drwxrwxr-x 5 vagrant vagrant 4096 Jul 16 2018 byebug-10.0.2
drwxrwxr-x 5 vagrant vagrant 4096 Jul 18 2018 byebug-9.0.6
drwxrwxr-x 5 vagrant vagrant 4096 Jul 22 2018 capybara-2.18.0
drwxrwxr-x 3 vagrant vagrant 4096 Mar 2 15:27 carrierwave-1.2.2
drwxrwxr-x 3 vagrant vagrant 4096 Mar 2 15:26 CFPropertyList-2.3.6
drwxrwxr-x 4 vagrant vagrant 4096 Jul 22 2018 childprocess-0.9.0
drwxrwxr-x 4 vagrant vagrant 4096 Jul 18 2018 coderay-1.1.2
drwxrwxr-x 3 vagrant vagrant 4096 Jul 18 2018 coffee-rails-4.2.2
drwxrwxr-x 3 vagrant vagrant 4096 Jul 18 2018 coffee-script-2.4.1
drwxrwxr-x 3 vagrant vagrant 4096 Jul 18 2018 coffee-script-source-1.12.2
drwxrwxr-x 3 vagrant vagrant 4096 Jul 16 2018 concurrent-ruby-1.0.5
drwxrwxr-x 4 vagrant vagrant 4096 Jul 16 2018 crass-1.0.4
drwxrwxr-x 3 vagrant vagrant 4096 Jul 16 2018 database_cleaner-1.7.0
drwxrwxr-x 7 vagrant vagrant 4096 Jul 16 2018 diff-lcs-1.3
drwxrwxr-x 6 vagrant vagrant 4096 Mar 2 15:27 domain_name-0.5.20180417
drwxrwxr-x 3 vagrant vagrant 4096 Mar 2 15:27 dry-inflector-0.1.2
drwxrwxr-x 4 vagrant vagrant 4096 Jul 16 2018 erubi-1.7.1
drwxrwxr-x 7 vagrant vagrant 4096 Mar 2 15:27 excon-0.62.0
drwxrwxr-x 3 vagrant vagrant 4096 Jul 18 2018 execjs-2.7.0
drwxrwxr-x 4 vagrant vagrant 4096 Jul 16 2018 factory_girl-4.9.0
drwxrwxr-x 8 vagrant vagrant 4096 Jul 16 2018 factory_girl_rails-4.9.0
drwxrwxr-x 3 vagrant vagrant 4096 Mar 2 15:27 faker-1.7.3
drwxrwxr-x 3 vagrant vagrant 4096 Jul 16 2018 faker-1.9.1
drwxrwxr-x 5 vagrant vagrant 4096 Jul 16 2018 ffi-1.9.25
drwxrwxr-x 5 vagrant vagrant 4096 Mar 2 15:27 fission-0.5.0
drwxrwxr-x 4 vagrant vagrant 4096 Mar 2 15:27 fog-aliyun-0.3.2
drwxrwxr-x 5 vagrant vagrant 4096 Mar 2 15:27 fog-atmos-0.1.0
drwxrwxr-x 5 vagrant vagrant 4096 Mar 2 15:27 fog-aws-2.0.1
drwxrwxr-x 6 vagrant vagrant 4096 Mar 2 15:27 fog-brightbox-0.16.1
drwxrwxr-x 5 vagrant vagrant 4096 Mar 2 15:27 fog-cloudatcost-0.1.2
drwxrwxr-x 4 vagrant vagrant 4096 Mar 2 15:27 fog-core-1.45.0
drwxrwxr-x 5 vagrant vagrant 4096 Mar 2 15:27 fog-digitalocean-0.4.0
drwxrwxr-x 5 vagrant vagrant 4096 Mar 2 15:27 fog-dnsimple-1.0.0
drwxrwxr-x 5 vagrant vagrant 4096 Mar 2 15:27 fog-dynect-0.0.3
drwxrwxr-x 6 vagrant vagrant 4096 Mar 2 15:27 fog-ecloud-0.3.0
drwxrwxr-x 7 vagrant vagrant 4096 Mar 2 15:27 fog-google-0.1.0
drwxrwxr-x 5 vagrant vagrant 4096 Mar 2 15:27 fog-internet-archive-0.0.1
drwxrwxr-x 4 vagrant vagrant 4096 Mar 2 15:27 fog-joyent-0.0.1
drwxrwxr-x 4 vagrant vagrant 4096 Mar 2 15:27 fog-json-1.2.0
drwxrwxr-x 4 vagrant vagrant 4096 Mar 2 15:27 fog-local-0.6.0
drwxrwxr-x 8 vagrant vagrant 4096 Mar 2 15:27 fog-openstack-0.3.6
drwxrwxr-x 5 vagrant vagrant 4096 Mar 2 15:27 fog-xml-0.1.3
drwxrwxr-x 4 vagrant vagrant 4096 Jul 18 2018 formatador-0.2.5
drwxrwxr-x 3 vagrant vagrant 4096 Jul 16 2018 globalid-0.4.1
drwxrwxr-x 6 vagrant vagrant 4096 Jul 18 2018 guard-2.13.0
drwxrwxr-x 4 vagrant vagrant 4096 Jul 18 2018 guard-compat-1.2.1
drwxrwxr-x 3 vagrant vagrant 4096 Jul 18 2018 guard-minitest-2.4.4
drwxrwxr-x 5 vagrant vagrant 4096 Jul 18 2018 i18n-0.9.5
drwxrwxr-x 5 vagrant vagrant 4096 Jul 16 2018 i18n-1.0.1
drwxrwxr-x 5 vagrant vagrant 4096 Sep 4 2018 i18n-1.1.0
drwxrwxr-x 5 vagrant vagrant 4096 Oct 27 17:29 i18n-1.1.1
drwxrwxr-x 4 vagrant vagrant 4096 Mar 2 15:27 ipaddress-0.8.3
drwxrwxr-x 5 vagrant vagrant 4096 Jul 18 2018 jbuilder-2.7.0
drwxrwxr-x 5 vagrant vagrant 4096 Jul 18 2018 jquery-rails-4.3.1
drwxrwxr-x 5 vagrant vagrant 4096 Jul 18 2018 libv8-3.16.14.19-x86_64-linux
drwxrwxr-x 4 vagrant vagrant 4096 Jul 16 2018 listen-3.1.5
drwxrwxr-x 5 vagrant vagrant 4096 Jul 16 2018 loofah-2.2.2
drwxrwxr-x 4 vagrant vagrant 4096 Jul 18 2018 lumberjack-1.0.13
drwxrwxr-x 3 vagrant vagrant 4096 Jul 16 2018 mail-2.7.0
drwxrwxr-x 3 vagrant vagrant 4096 Oct 27 17:30 mail-2.7.1
drwxrwxr-x 4 vagrant vagrant 4096 Jul 16 2018 method_source-0.9.0
drwxrwxr-x 4 vagrant vagrant 4096 Mar 2 15:26 mime-types-3.2.2
drwxrwxr-x 5 vagrant vagrant 4096 Mar 2 15:26 mime-types-data-3.2018.0812
drwxrwxr-x 5 vagrant vagrant 4096 Jul 16 2018 mini_mime-1.0.0
drwxrwxr-x 5 vagrant vagrant 4096 Sep 4 2018 mini_mime-1.0.1
drwxrwxr-x 5 vagrant vagrant 4096 Jul 16 2018 mini_portile2-2.3.0
drwxrwxr-x 4 vagrant vagrant 4096 Mar 2 15:26 minitest-5.10.3
drwxrwxr-x 4 vagrant vagrant 4096 Jul 16 2018 minitest-5.11.3
drwxrwxr-x 5 vagrant vagrant 4096 Jul 18 2018 minitest-reporters-1.1.14
drwxrwxr-x 3 vagrant vagrant 4096 Jul 18 2018 multi_json-1.13.1
drwxrwxr-x 3 vagrant vagrant 4096 Jul 18 2018 nenv-0.3.0
drwxrwxr-x 7 vagrant vagrant 4096 Jul 16 2018 nio4r-2.3.1
drwxrwxr-x 9 vagrant vagrant 4096 Jul 16 2018 nokogiri-1.8.4
drwxrwxr-x 9 vagrant vagrant 4096 Oct 27 17:30 nokogiri-1.8.5
drwxrwxr-x 4 vagrant vagrant 4096 Jul 18 2018 notiffany-0.1.1
drwxrwxr-x 4 vagrant vagrant 4096 Mar 2 15:27 ovirt-engine-sdk-4.2.5
drwxrwxr-x 4 vagrant vagrant 4096 Jul 18 2018 pry-0.11.3
drwxrwxr-x 6 vagrant vagrant 4096 Jul 22 2018 public_suffix-3.0.2
drwxrwxr-x 6 vagrant vagrant 4096 Sep 4 2018 public_suffix-3.0.3
drwxrwxr-x 7 vagrant vagrant 4096 Jul 16 2018 puma-3.12.0
drwxrwxr-x 9 vagrant vagrant 4096 Jul 18 2018 puma-3.9.1
drwxrwxr-x 7 vagrant vagrant 4096 Jul 16 2018 rack-2.0.5
drwxrwxr-x 3 vagrant vagrant 4096 Mar 11 23:27 rack-mini-profiler-1.0.2
drwxrwxr-x 3 vagrant vagrant 4096 Jul 16 2018 rack-test-1.0.0
drwxrwxr-x 3 vagrant vagrant 4096 Jul 22 2018 rack-test-1.1.0
drwxrwxr-x 2 vagrant vagrant 4096 Jul 18 2018 rails-5.1.4
drwxrwxr-x 2 vagrant vagrant 4096 Jul 16 2018 rails-5.1.6
drwxrwxr-x 4 vagrant vagrant 4096 Jul 18 2018 rails-controller-testing-1.0.2
drwxrwxr-x 4 vagrant vagrant 4096 Jul 16 2018 rails-dom-testing-2.0.3
drwxrwxr-x 4 vagrant vagrant 4096 Jul 16 2018 rails-html-sanitizer-1.0.4
drwxrwxr-x 4 vagrant vagrant 4096 Jul 18 2018 railties-5.1.4
drwxrwxr-x 4 vagrant vagrant 4096 Jul 16 2018 railties-5.1.6
drwxrwxr-x 6 vagrant vagrant 4096 Jul 16 2018 rake-12.3.1
drwxrwxr-x 5 vagrant vagrant 4096 Jul 16 2018 rb-fsevent-0.10.3
drwxrwxr-x 4 vagrant vagrant 4096 Jul 16 2018 rb-inotify-0.9.10
drwxr-xr-x 3 vagrant vagrant 4096 Jul 7 2018 rdoc-6.0.1
drwxrwxr-x 4 vagrant vagrant 4096 Jul 18 2018 ref-2.0.0
drwxrwxr-x 4 vagrant vagrant 4096 Jul 16 2018 rspec-core-3.7.1
drwxrwxr-x 3 vagrant vagrant 4096 Jul 16 2018 rspec-expectations-3.7.0
drwxrwxr-x 3 vagrant vagrant 4096 Jul 16 2018 rspec-mocks-3.7.0
drwxrwxr-x 3 vagrant vagrant 4096 Jul 16 2018 rspec-rails-3.7.2
drwxrwxr-x 3 vagrant vagrant 4096 Jul 16 2018 rspec-support-3.7.1
drwxrwxr-x 3 vagrant vagrant 4096 Jul 16 2018 ruby_dep-1.5.0
drwxrwxr-x 8 vagrant vagrant 4096 Jul 16 2018 rubygems-update-2.7.7
drwxrwxr-x 3 vagrant vagrant 4096 Jul 18 2018 ruby-progressbar-1.9.0
drwxrwxr-x 5 vagrant vagrant 4096 Jul 22 2018 rubyzip-1.2.1
drwxrwxr-x 5 vagrant vagrant 4096 Sep 4 2018 rubyzip-1.2.2
drwxrwxr-x 7 vagrant vagrant 4096 Jul 18 2018 sass-3.5.6
drwxrwxr-x 7 vagrant vagrant 4096 Jul 22 2018 sass-3.5.7
drwxrwxr-x 7 vagrant vagrant 4096 Oct 27 17:30 sass-3.6.0
drwxrwxr-x 3 vagrant vagrant 4096 Jul 18 2018 sass-listen-4.0.0
drwxrwxr-x 3 vagrant vagrant 4096 Jul 18 2018 sass-rails-5.0.6
drwxrwxr-x 3 vagrant vagrant 4096 Jul 22 2018 sass-rails-5.0.7
drwxrwxr-x 3 vagrant vagrant 4096 Jul 22 2018 selenium-webdriver-3.13.1
drwxrwxr-x 3 vagrant vagrant 4096 Sep 4 2018 selenium-webdriver-3.14.0
drwxrwxr-x 3 vagrant vagrant 4096 Oct 27 21:03 selenium-webdriver-3.14.1
drwxrwxr-x 4 vagrant vagrant 4096 Jul 18 2018 shellany-0.0.1
drwxrwxr-x 10 vagrant vagrant 4096 Jul 16 2018 shoulda-matchers-3.1.2
drwxrwxr-x 4 vagrant vagrant 4096 Jul 16 2018 spring-2.0.2
drwxrwxr-x 4 vagrant vagrant 4096 Jul 16 2018 spring-watcher-listen-2.0.1
drwxrwxr-x 4 vagrant vagrant 4096 Jul 16 2018 sprockets-3.7.2
drwxrwxr-x 3 vagrant vagrant 4096 Jul 16 2018 sprockets-rails-3.2.1
drwxrwxr-x 7 vagrant vagrant 4096 Jul 16 2018 sqlite3-1.3.13
drwxrwxr-x 5 vagrant vagrant 4096 Jul 18 2018 therubyracer-0.12.3
drwxrwxr-x 4 vagrant vagrant 4096 Jul 16 2018 thor-0.20.0
drwxrwxr-x 8 vagrant vagrant 4096 Jul 16 2018 thread_safe-0.3.6
drwxrwxr-x 7 vagrant vagrant 4096 Jul 18 2018 tilt-2.0.8
drwxrwxr-x 3 vagrant vagrant 4096 Jul 18 2018 turbolinks-5.0.1
drwxrwxr-x 3 vagrant vagrant 4096 Jul 22 2018 turbolinks-5.1.1
drwxrwxr-x 3 vagrant vagrant 4096 Sep 4 2018 turbolinks-5.2.0
drwxrwxr-x 3 vagrant vagrant 4096 Jul 18 2018 turbolinks-source-5.1.0
drwxrwxr-x 3 vagrant vagrant 4096 Sep 4 2018 turbolinks-source-5.2.0
drwxrwxr-x 4 vagrant vagrant 4096 Jul 16 2018 tzinfo-1.2.5
drwxrwxr-x 3 vagrant vagrant 4096 Jul 18 2018 uglifier-3.2.0
drwxrwxr-x 3 vagrant vagrant 4096 Jul 22 2018 uglifier-4.1.15
drwxrwxr-x 3 vagrant vagrant 4096 Jul 26 2018 uglifier-4.1.16
drwxrwxr-x 3 vagrant vagrant 4096 Sep 4 2018 uglifier-4.1.18
drwxrwxr-x 3 vagrant vagrant 4096 Sep 17 2018 uglifier-4.1.19
drwxrwxr-x 4 vagrant vagrant 4096 Mar 2 15:27 unf-0.1.4
drwxrwxr-x 5 vagrant vagrant 4096 Mar 2 15:27 unf_ext-0.0.7.5
drwxrwxr-x 3 vagrant vagrant 4096 Jul 18 2018 web-console-3.5.1
drwxrwxr-x 3 vagrant vagrant 4096 Jul 22 2018 web-console-3.6.2
drwxrwxr-x 3 vagrant vagrant 4096 Sep 4 2018 web-console-3.7.0
drwxrwxr-x 5 vagrant vagrant 4096 Jul 16 2018 websocket-driver-0.6.5
drwxrwxr-x 3 vagrant vagrant 4096 Jul 16 2018 websocket-extensions-0.1.3
drwxrwxr-x 4 vagrant vagrant 4096 Mar 2 15:26 will_paginate-3.1.6
drwxrwxr-x 3 vagrant vagrant 4096 Mar 2 15:27 xml-simple-1.1.5
drwxrwxr-x 4 vagrant vagrant 4096 Jul 22 2018 xpath-3.1.0
drwxrwxr-x 4 vagrant vagrant 4096 Oct 27 21:03 xpath-3.2.0
さきほどgem list
で調べたバージョンとあってそう。
クリーンにする
以下を参考にruby-2.5.0に紐づいているgemを全てきれいにする。
vagrant@ubuntu-xenial:~/tmp$ gem uninstall -I -a -x --user-install --force
Successfully uninstalled CFPropertyList-2.3.6
Successfully uninstalled actioncable-5.1.6
Successfully uninstalled actioncable-5.1.4
Successfully uninstalled actionmailer-5.1.6
Successfully uninstalled actionmailer-5.1.4
Successfully uninstalled actionpack-5.1.6
Successfully uninstalled actionpack-5.1.4
Successfully uninstalled actionview-5.1.6
Successfully uninstalled actionview-5.1.4
Successfully uninstalled activejob-5.1.6
Successfully uninstalled activejob-5.1.4
Successfully uninstalled activemodel-5.1.6
Successfully uninstalled activemodel-5.1.4
Successfully uninstalled activerecord-5.1.6
Successfully uninstalled activerecord-5.1.4
Successfully uninstalled activesupport-5.1.6
Successfully uninstalled activesupport-5.1.4
Successfully uninstalled addressable-2.5.2
Successfully uninstalled ansi-1.5.0
Successfully uninstalled arel-8.0.0
Successfully uninstalled autoprefixer-rails-9.1.4
Successfully uninstalled autoprefixer-rails-8.6.5
Successfully uninstalled bcrypt-3.1.12
Successfully uninstalled bcrypt-3.1.11
Successfully uninstalled bindex-0.5.0
Successfully uninstalled bootstrap-sass-3.3.7
Successfully uninstalled bootstrap-will_paginate-1.0.0
Successfully uninstalled builder-3.2.3
Successfully uninstalled byebug-10.0.2
Removing byebug
Successfully uninstalled byebug-9.0.6
Successfully uninstalled capybara-2.18.0
Successfully uninstalled carrierwave-1.2.2
Successfully uninstalled childprocess-0.9.0
Removing coderay
Successfully uninstalled coderay-1.1.2
Successfully uninstalled coffee-rails-4.2.2
Successfully uninstalled coffee-script-2.4.1
Successfully uninstalled coffee-script-source-1.12.2
Successfully uninstalled concurrent-ruby-1.0.5
Successfully uninstalled crass-1.0.4
Successfully uninstalled database_cleaner-1.7.0
Removing htmldiff
Removing ldiff
Successfully uninstalled diff-lcs-1.3
Successfully uninstalled domain_name-0.5.20180417
Successfully uninstalled dry-inflector-0.1.2
Successfully uninstalled erubi-1.7.1
Successfully uninstalled excon-0.62.0
Successfully uninstalled execjs-2.7.0
Successfully uninstalled factory_girl-4.9.0
Successfully uninstalled factory_girl_rails-4.9.0
Successfully uninstalled faker-1.9.1
Successfully uninstalled faker-1.7.3
Successfully uninstalled ffi-1.9.25
Removing fission
Successfully uninstalled fission-0.5.0
Successfully uninstalled fog-aliyun-0.3.2
Successfully uninstalled fog-atmos-0.1.0
Successfully uninstalled fog-aws-2.0.1
Successfully uninstalled fog-brightbox-0.16.1
Successfully uninstalled fog-cloudatcost-0.1.2
Successfully uninstalled fog-core-1.45.0
Successfully uninstalled fog-digitalocean-0.4.0
Removing console
Removing setup
Successfully uninstalled fog-dnsimple-1.0.0
Successfully uninstalled fog-dynect-0.0.3
Successfully uninstalled fog-ecloud-0.3.0
Successfully uninstalled fog-google-0.1.0
Successfully uninstalled fog-internet-archive-0.0.1
Successfully uninstalled fog-joyent-0.0.1
Successfully uninstalled fog-json-1.2.0
Successfully uninstalled fog-local-0.6.0
Successfully uninstalled fog-openstack-0.3.6
Successfully uninstalled fog-xml-0.1.3
Successfully uninstalled formatador-0.2.5
Successfully uninstalled globalid-0.4.1
Removing guard
Removing _guard-core
Successfully uninstalled guard-2.13.0
Successfully uninstalled guard-compat-1.2.1
Successfully uninstalled guard-minitest-2.4.4
Successfully uninstalled i18n-1.1.1
Successfully uninstalled i18n-1.1.0
Successfully uninstalled i18n-1.0.1
Successfully uninstalled i18n-0.9.5
Successfully uninstalled ipaddress-0.8.3
Successfully uninstalled jbuilder-2.7.0
Successfully uninstalled jquery-rails-4.3.1
Successfully uninstalled libv8-3.16.14.19-x86_64-linux
Removing listen
Successfully uninstalled listen-3.1.5
Successfully uninstalled loofah-2.2.2
Successfully uninstalled lumberjack-1.0.13
Successfully uninstalled mail-2.7.1
Successfully uninstalled mail-2.7.0
Successfully uninstalled method_source-0.9.0
Successfully uninstalled mime-types-3.2.2
Successfully uninstalled mime-types-data-3.2018.0812
Successfully uninstalled mini_mime-1.0.1
Successfully uninstalled mini_mime-1.0.0
Successfully uninstalled mini_portile2-2.3.0
Successfully uninstalled minitest-5.11.3
Successfully uninstalled minitest-5.10.3
Successfully uninstalled minitest-reporters-1.1.14
Successfully uninstalled multi_json-1.13.1
Successfully uninstalled nenv-0.3.0
Successfully uninstalled nio4r-2.3.1
Successfully uninstalled nokogiri-1.8.5
Removing nokogiri
Successfully uninstalled nokogiri-1.8.4
Successfully uninstalled notiffany-0.1.1
Removing pry
Successfully uninstalled pry-0.11.3
Successfully uninstalled public_suffix-3.0.3
Successfully uninstalled public_suffix-3.0.2
Successfully uninstalled puma-3.12.0
Removing puma
Removing pumactl
Successfully uninstalled puma-3.9.1
Removing rackup
Successfully uninstalled rack-2.0.5
Successfully uninstalled rack-mini-profiler-1.0.2
Successfully uninstalled rack-test-1.1.0
Successfully uninstalled rack-test-1.0.0
Successfully uninstalled rails-5.1.6
Successfully uninstalled rails-5.1.4
Successfully uninstalled rails-controller-testing-1.0.2
Successfully uninstalled rails-dom-testing-2.0.3
Successfully uninstalled rails-html-sanitizer-1.0.4
Successfully uninstalled railties-5.1.6
Removing rails
Successfully uninstalled railties-5.1.4
Removing rake
Successfully uninstalled rake-12.3.1
Successfully uninstalled rb-fsevent-0.10.3
Successfully uninstalled rb-inotify-0.9.10
Successfully uninstalled ref-2.0.0
Removing rspec
Successfully uninstalled rspec-core-3.7.1
Successfully uninstalled rspec-expectations-3.7.0
Successfully uninstalled rspec-mocks-3.7.0
Successfully uninstalled rspec-rails-3.7.2
Successfully uninstalled rspec-support-3.7.1
Successfully uninstalled ruby-progressbar-1.9.0
Successfully uninstalled ruby_dep-1.5.0
Removing update_rubygems
Successfully uninstalled rubygems-update-2.7.7
Successfully uninstalled rubyzip-1.2.2
Successfully uninstalled rubyzip-1.2.1
Successfully uninstalled sass-3.6.0
Successfully uninstalled sass-3.5.7
Removing sass
Removing sass-convert
Removing scss
Successfully uninstalled sass-3.5.6
Successfully uninstalled sass-listen-4.0.0
Successfully uninstalled sass-rails-5.0.7
Successfully uninstalled sass-rails-5.0.6
Successfully uninstalled selenium-webdriver-3.14.1
Successfully uninstalled selenium-webdriver-3.14.0
Successfully uninstalled selenium-webdriver-3.13.1
Successfully uninstalled shellany-0.0.1
Successfully uninstalled shoulda-matchers-3.1.2
Removing spring
Successfully uninstalled spring-2.0.2
Successfully uninstalled spring-watcher-listen-2.0.1
Removing sprockets
Successfully uninstalled sprockets-3.7.2
Successfully uninstalled sprockets-rails-3.2.1
Successfully uninstalled sqlite3-1.3.13
Successfully uninstalled therubyracer-0.12.3
Removing thor
Successfully uninstalled thor-0.20.0
Successfully uninstalled thread_safe-0.3.6
Removing tilt
Successfully uninstalled tilt-2.0.8
Successfully uninstalled turbolinks-5.2.0
Successfully uninstalled turbolinks-5.1.1
Successfully uninstalled turbolinks-5.0.1
Successfully uninstalled turbolinks-source-5.2.0
Successfully uninstalled turbolinks-source-5.1.0
Successfully uninstalled tzinfo-1.2.5
Successfully uninstalled uglifier-4.1.19
Successfully uninstalled uglifier-4.1.18
Successfully uninstalled uglifier-4.1.16
Successfully uninstalled uglifier-4.1.15
Successfully uninstalled uglifier-3.2.0
Successfully uninstalled unf-0.1.4
Successfully uninstalled unf_ext-0.0.7.5
Successfully uninstalled web-console-3.7.0
Successfully uninstalled web-console-3.6.2
Successfully uninstalled web-console-3.5.1
Successfully uninstalled websocket-driver-0.6.5
Successfully uninstalled websocket-extensions-0.1.3
Successfully uninstalled will_paginate-3.1.6
Successfully uninstalled xml-simple-1.1.5
Successfully uninstalled xpath-3.2.0
Successfully uninstalled xpath-3.1.0
INFO: Uninstalled all gems in
vagrant@ubuntu-xenial:~/tmp$
再度チェックする。
vagrant@ubuntu-xenial:~/tmp/sample_app$ ls -la /home/vagrant/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/
total 28
drwxr-xr-x 5 vagrant vagrant 12288 Mar 26 22:12 .
drwxr-xr-x 8 vagrant vagrant 4096 Mar 11 23:27 ..
drwxrwxr-x 3 vagrant vagrant 4096 Jul 16 2018 bundler-1.16.2
drwxrwxr-x 4 vagrant vagrant 4096 Mar 2 15:27 ovirt-engine-sdk-4.2.5
drwxr-xr-x 3 vagrant vagrant 4096 Jul 7 2018 rdoc-6.0.1
vagrant@ubuntu-xenial:~/tmp$ gem list
*** LOCAL GEMS ***
bigdecimal (default: 1.3.4)
bundler (default: 1.16.2)
cmath (default: 1.0.0)
csv (default: 1.0.0)
date (default: 1.0.0)
dbm (default: 1.0.0)
etc (default: 1.0.0)
fcntl (default: 1.0.0)
fiddle (default: 1.0.0)
fileutils (default: 1.0.2)
gdbm (default: 2.0.0)
io-console (default: 0.4.6)
ipaddr (default: 1.2.0)
json (default: 2.1.0)
openssl (default: 2.1.0)
psych (default: 3.0.2)
rdoc (default: 6.0.1)
scanf (default: 1.0.0)
sdbm (default: 1.0.0)
stringio (default: 0.0.1)
strscan (default: 1.0.0)
webrick (default: 1.4.2)
zlib (default: 1.0.0)
ゴミが残っていたので専用のスクリプトを用意する。
vagrant@ubuntu-xenial:~/cc2ba08062c6183a489c$ sh uninstall_gems.sh
/home/vagrant/.rbenv
---------------------------------------
2.4.1
Successfully uninstalled actioncable-5.1.4
Successfully uninstalled actionmailer-5.1.4
Successfully uninstalled actionpack-5.1.4
Successfully uninstalled actionview-5.1.4
Successfully uninstalled activejob-5.1.4
Successfully uninstalled activemodel-5.1.4
Successfully uninstalled activerecord-5.1.4
Successfully uninstalled activesupport-5.1.4
Successfully uninstalled ansi-1.5.0
Successfully uninstalled arel-8.0.0
Successfully uninstalled autoprefixer-rails-8.6.5
Successfully uninstalled bcrypt-3.1.11
ERROR: While executing gem ... (Gem::InstallError)
gem "bigdecimal" cannot be uninstalled because it is a default gem
Successfully uninstalled bindex-0.5.0
Successfully uninstalled bootstrap-sass-3.3.7
Successfully uninstalled bootstrap-will_paginate-1.0.0
Successfully uninstalled builder-3.2.3
Removing bundle
Removing bundler
Successfully uninstalled bundler-1.16.3
Removing byebug
Successfully uninstalled byebug-9.0.6
Removing coderay
Successfully uninstalled coderay-1.1.2
Successfully uninstalled coffee-rails-4.2.2
Successfully uninstalled coffee-script-2.4.1
Successfully uninstalled coffee-script-source-1.12.2
Successfully uninstalled concurrent-ruby-1.0.5
Successfully uninstalled crass-1.0.4
Successfully uninstalled did_you_mean-1.1.0
Successfully uninstalled erubi-1.7.1
Successfully uninstalled execjs-2.7.0
Successfully uninstalled faker-1.7.3
Successfully uninstalled ffi-1.9.25
Successfully uninstalled formatador-0.2.5
Successfully uninstalled globalid-0.4.1
Removing guard
Removing _guard-core
Successfully uninstalled guard-2.13.0
Successfully uninstalled guard-compat-1.2.1
Successfully uninstalled guard-minitest-2.4.4
Successfully uninstalled i18n-0.9.5
ERROR: While executing gem ... (Gem::InstallError)
gem "io-console" cannot be uninstalled because it is a default gem
Successfully uninstalled jbuilder-2.7.0
Successfully uninstalled jquery-rails-4.3.1
ERROR: While executing gem ... (Gem::InstallError)
gem "json" cannot be uninstalled because it is a default gem
Successfully uninstalled libv8-3.16.14.19-x86_64-linux
Removing listen
Successfully uninstalled listen-3.1.5
Successfully uninstalled loofah-2.2.2
Successfully uninstalled lumberjack-1.0.13
Successfully uninstalled mail-2.7.0
Successfully uninstalled method_source-0.9.0
Successfully uninstalled mini_mime-1.0.0
Successfully uninstalled mini_portile2-2.3.0
Successfully uninstalled minitest-5.10.1
Successfully uninstalled minitest-5.11.3
Successfully uninstalled minitest-reporters-1.1.14
Successfully uninstalled multi_json-1.13.1
Successfully uninstalled nenv-0.3.0
Successfully uninstalled net-telnet-0.1.1
Successfully uninstalled nio4r-2.3.1
Removing nokogiri
Successfully uninstalled nokogiri-1.8.4
Successfully uninstalled notiffany-0.1.1
ERROR: While executing gem ... (Gem::InstallError)
gem "openssl" cannot be uninstalled because it is a default gem
Successfully uninstalled power_assert-0.4.1
Removing pry
Successfully uninstalled pry-0.11.3
ERROR: While executing gem ... (Gem::InstallError)
gem "psych" cannot be uninstalled because it is a default gem
Removing puma
Removing pumactl
Successfully uninstalled puma-3.9.1
Removing rackup
Successfully uninstalled rack-2.0.5
Successfully uninstalled rack-test-1.0.0
Successfully uninstalled rails-5.1.4
Successfully uninstalled rails-controller-testing-1.0.2
Successfully uninstalled rails-dom-testing-2.0.3
Successfully uninstalled rails-html-sanitizer-1.0.4
Removing rails
Successfully uninstalled railties-5.1.4
Successfully uninstalled rake-12.0.0
Removing rake
Successfully uninstalled rake-12.3.1
Successfully uninstalled rb-fsevent-0.10.3
Successfully uninstalled rb-inotify-0.9.10
ERROR: While executing gem ... (Gem::InstallError)
gem "rdoc" cannot be uninstalled because it is a default gem
Successfully uninstalled ref-2.0.0
Successfully uninstalled ruby-progressbar-1.9.0
Successfully uninstalled ruby_dep-1.5.0
Removing sass
Removing sass-convert
Removing scss
Successfully uninstalled sass-3.5.6
Successfully uninstalled sass-listen-4.0.0
Successfully uninstalled sass-rails-5.0.6
Successfully uninstalled shellany-0.0.1
Removing spring
Successfully uninstalled spring-2.0.2
Successfully uninstalled spring-watcher-listen-2.0.1
Removing sprockets
Successfully uninstalled sprockets-3.7.2
Successfully uninstalled sprockets-rails-3.2.1
Successfully uninstalled sqlite3-1.3.13
Successfully uninstalled test-unit-3.2.3
Successfully uninstalled therubyracer-0.12.3
Removing thor
Successfully uninstalled thor-0.20.0
Successfully uninstalled thread_safe-0.3.6
Removing tilt
Successfully uninstalled tilt-2.0.8
Successfully uninstalled turbolinks-5.0.1
Successfully uninstalled turbolinks-source-5.1.0
Successfully uninstalled tzinfo-1.2.5
Successfully uninstalled uglifier-3.2.0
Successfully uninstalled web-console-3.5.1
Successfully uninstalled websocket-driver-0.6.5
Successfully uninstalled websocket-extensions-0.1.3
Successfully uninstalled will_paginate-3.1.6
Successfully uninstalled xmlrpc-0.2.1
*** LOCAL GEMS ***
bigdecimal (default: 1.3.0)
io-console (default: 0.4.6)
json (default: 2.0.2)
openssl (default: 2.0.3)
psych (default: 2.2.2)
rdoc (default: 5.0.0)
Fetching: bundler-2.0.1.gem (100%)
Successfully installed bundler-2.0.1
1 gem installed
---------------------------------------
2.5.0
ERROR: While executing gem ... (Gem::InstallError)
gem "bigdecimal" cannot be uninstalled because it is a default gem
ERROR: While executing gem ... (Gem::InstallError)
gem "bundler" cannot be uninstalled because it is a default gem
ERROR: While executing gem ... (Gem::InstallError)
gem "cmath" cannot be uninstalled because it is a default gem
ERROR: While executing gem ... (Gem::InstallError)
gem "csv" cannot be uninstalled because it is a default gem
ERROR: While executing gem ... (Gem::InstallError)
gem "date" cannot be uninstalled because it is a default gem
ERROR: While executing gem ... (Gem::InstallError)
gem "dbm" cannot be uninstalled because it is a default gem
ERROR: While executing gem ... (Gem::InstallError)
gem "etc" cannot be uninstalled because it is a default gem
ERROR: While executing gem ... (Gem::InstallError)
gem "fcntl" cannot be uninstalled because it is a default gem
ERROR: While executing gem ... (Gem::InstallError)
gem "fiddle" cannot be uninstalled because it is a default gem
ERROR: While executing gem ... (Gem::InstallError)
gem "fileutils" cannot be uninstalled because it is a default gem
ERROR: While executing gem ... (Gem::InstallError)
gem "gdbm" cannot be uninstalled because it is a default gem
ERROR: While executing gem ... (Gem::InstallError)
gem "io-console" cannot be uninstalled because it is a default gem
ERROR: While executing gem ... (Gem::InstallError)
gem "ipaddr" cannot be uninstalled because it is a default gem
ERROR: While executing gem ... (Gem::InstallError)
gem "json" cannot be uninstalled because it is a default gem
ERROR: While executing gem ... (Gem::InstallError)
gem "openssl" cannot be uninstalled because it is a default gem
ERROR: While executing gem ... (Gem::InstallError)
gem "psych" cannot be uninstalled because it is a default gem
ERROR: While executing gem ... (Gem::InstallError)
gem "rdoc" cannot be uninstalled because it is a default gem
ERROR: While executing gem ... (Gem::InstallError)
gem "scanf" cannot be uninstalled because it is a default gem
ERROR: While executing gem ... (Gem::InstallError)
gem "sdbm" cannot be uninstalled because it is a default gem
ERROR: While executing gem ... (Gem::InstallError)
gem "stringio" cannot be uninstalled because it is a default gem
ERROR: While executing gem ... (Gem::InstallError)
gem "strscan" cannot be uninstalled because it is a default gem
ERROR: While executing gem ... (Gem::InstallError)
gem "webrick" cannot be uninstalled because it is a default gem
ERROR: While executing gem ... (Gem::InstallError)
gem "zlib" cannot be uninstalled because it is a default gem
*** LOCAL GEMS ***
bigdecimal (default: 1.3.4)
bundler (default: 1.16.2)
cmath (default: 1.0.0)
csv (default: 1.0.0)
date (default: 1.0.0)
dbm (default: 1.0.0)
etc (default: 1.0.0)
fcntl (default: 1.0.0)
fiddle (default: 1.0.0)
fileutils (default: 1.0.2)
gdbm (default: 2.0.0)
io-console (default: 0.4.6)
ipaddr (default: 1.2.0)
json (default: 2.1.0)
openssl (default: 2.1.0)
psych (default: 3.0.2)
rdoc (default: 6.0.1)
scanf (default: 1.0.0)
sdbm (default: 1.0.0)
stringio (default: 0.0.1)
strscan (default: 1.0.0)
webrick (default: 1.4.2)
zlib (default: 1.0.0)
Fetching: bundler-2.0.1.gem (100%)
bundler's executable "bundle" conflicts with /home/vagrant/.rbenv/versions/2.5.0/bin/bundle
Overwrite the executable? [yN] y
Successfully installed bundler-2.0.1
1 gem installed
---------------------------------------
2.5.1
Successfully uninstalled actioncable-5.1.4
Successfully uninstalled actioncable-5.2.1
Successfully uninstalled actionmailer-5.1.4
Successfully uninstalled actionmailer-5.2.1
Successfully uninstalled actionpack-5.1.4
Successfully uninstalled actionpack-5.2.1
Successfully uninstalled actionview-5.1.4
Successfully uninstalled actionview-5.2.1
Successfully uninstalled activejob-5.1.4
Successfully uninstalled activejob-5.2.1
Successfully uninstalled activemodel-5.1.4
Successfully uninstalled activemodel-5.2.1
Successfully uninstalled activerecord-5.1.4
Successfully uninstalled activerecord-5.2.1
Successfully uninstalled activestorage-5.2.1
Successfully uninstalled activesupport-5.1.4
Successfully uninstalled activesupport-5.2.1
Successfully uninstalled addressable-2.5.2
Successfully uninstalled ansi-1.5.0
Successfully uninstalled archive-zip-0.11.0
Successfully uninstalled arel-8.0.0
Successfully uninstalled arel-9.0.0
Successfully uninstalled autoprefixer-rails-8.6.5
Successfully uninstalled bcrypt-3.1.11
ERROR: While executing gem ... (Gem::InstallError)
gem "bigdecimal" cannot be uninstalled because it is a default gem
Successfully uninstalled bindex-0.5.0
Successfully uninstalled bootsnap-1.3.2
Successfully uninstalled bootstrap-sass-3.3.7
Successfully uninstalled builder-3.2.3
Removing bundle
Removing bundler
Successfully uninstalled bundler-1.17.1
Successfully uninstalled byebug-9.0.6
Removing byebug
Successfully uninstalled byebug-10.0.2
Successfully uninstalled capybara-3.9.0
Successfully uninstalled childprocess-0.9.0
Removing chromedriver-helper
Removing chromedriver-update
Successfully uninstalled chromedriver-helper-2.1.0
ERROR: While executing gem ... (Gem::InstallError)
gem "cmath" cannot be uninstalled because it is a default gem
Removing coderay
Successfully uninstalled coderay-1.1.2
Successfully uninstalled coffee-rails-4.2.2
Successfully uninstalled coffee-script-2.4.1
Successfully uninstalled coffee-script-source-1.12.2
Successfully uninstalled concurrent-ruby-1.0.5
Successfully uninstalled crass-1.0.4
ERROR: While executing gem ... (Gem::InstallError)
gem "csv" cannot be uninstalled because it is a default gem
ERROR: While executing gem ... (Gem::InstallError)
gem "date" cannot be uninstalled because it is a default gem
ERROR: While executing gem ... (Gem::InstallError)
gem "dbm" cannot be uninstalled because it is a default gem
Successfully uninstalled did_you_mean-1.2.0
Successfully uninstalled erubi-1.7.1
Removing erubis
Successfully uninstalled erubis-2.7.0
ERROR: While executing gem ... (Gem::InstallError)
gem "etc" cannot be uninstalled because it is a default gem
Successfully uninstalled execjs-2.7.0
Successfully uninstalled faker-1.7.3
ERROR: While executing gem ... (Gem::InstallError)
gem "fcntl" cannot be uninstalled because it is a default gem
Successfully uninstalled ffi-1.9.25
ERROR: While executing gem ... (Gem::InstallError)
gem "fiddle" cannot be uninstalled because it is a default gem
ERROR: While executing gem ... (Gem::InstallError)
gem "fileutils" cannot be uninstalled because it is a default gem
Successfully uninstalled formatador-0.2.5
ERROR: While executing gem ... (Gem::InstallError)
gem "gdbm" cannot be uninstalled because it is a default gem
Successfully uninstalled globalid-0.4.1
Removing guard
Removing _guard-core
Successfully uninstalled guard-2.13.0
Successfully uninstalled guard-compat-1.2.1
Successfully uninstalled guard-minitest-2.4.4
Removing haml
Successfully uninstalled haml-5.0.4
Successfully uninstalled haml-rails-1.0.0
Removing html2haml
Successfully uninstalled html2haml-2.2.0
Successfully uninstalled i18n-0.9.5
Successfully uninstalled i18n-1.1.0
ERROR: While executing gem ... (Gem::InstallError)
gem "io-console" cannot be uninstalled because it is a default gem
Successfully uninstalled io-like-0.3.0
ERROR: While executing gem ... (Gem::InstallError)
gem "ipaddr" cannot be uninstalled because it is a default gem
Successfully uninstalled jbuilder-2.7.0
Successfully uninstalled jquery-rails-4.3.1
ERROR: While executing gem ... (Gem::InstallError)
gem "json" cannot be uninstalled because it is a default gem
Successfully uninstalled libv8-3.16.14.19-x86_64-linux
Removing listen
Successfully uninstalled listen-3.1.5
Successfully uninstalled loofah-2.2.2
Successfully uninstalled lumberjack-1.0.13
Successfully uninstalled mail-2.7.0
Successfully uninstalled marcel-0.3.3
Successfully uninstalled method_source-0.9.0
Successfully uninstalled mimemagic-0.3.2
Successfully uninstalled mini_mime-1.0.0
Successfully uninstalled mini_mime-1.0.1
Successfully uninstalled mini_portile2-2.3.0
Successfully uninstalled minitest-5.10.3
Successfully uninstalled minitest-5.11.3
Successfully uninstalled minitest-reporters-1.1.14
Successfully uninstalled msgpack-1.2.4
Successfully uninstalled multi_json-1.13.1
Successfully uninstalled nenv-0.3.0
Successfully uninstalled net-telnet-0.1.1
Successfully uninstalled nio4r-2.3.1
Successfully uninstalled nokogiri-1.8.4
Removing nokogiri
Successfully uninstalled nokogiri-1.8.5
Successfully uninstalled notiffany-0.1.1
ERROR: While executing gem ... (Gem::InstallError)
gem "openssl" cannot be uninstalled because it is a default gem
Successfully uninstalled power_assert-1.1.1
Removing pry
Successfully uninstalled pry-0.11.3
Successfully uninstalled pry-byebug-3.6.0
Successfully uninstalled pry-doc-0.13.4
Successfully uninstalled pry-rails-0.3.6
ERROR: While executing gem ... (Gem::InstallError)
gem "psych" cannot be uninstalled because it is a default gem
Successfully uninstalled public_suffix-3.0.3
Successfully uninstalled puma-3.9.1
Removing puma
Removing pumactl
Successfully uninstalled puma-3.12.0
Removing rackup
Successfully uninstalled rack-2.0.5
Successfully uninstalled rack-test-1.0.0
Successfully uninstalled rack-test-1.1.0
Successfully uninstalled rails-5.1.4
Successfully uninstalled rails-5.2.1
Successfully uninstalled rails-controller-testing-1.0.2
Successfully uninstalled rails-dom-testing-2.0.3
Successfully uninstalled rails-html-sanitizer-1.0.4
Successfully uninstalled railties-5.1.4
Removing rails
Successfully uninstalled railties-5.2.1
Successfully uninstalled rake-12.3.0
Removing rake
Successfully uninstalled rake-12.3.1
Successfully uninstalled rb-fsevent-0.10.3
Successfully uninstalled rb-inotify-0.9.10
ERROR: While executing gem ... (Gem::InstallError)
gem "rdoc" cannot be uninstalled because it is a default gem
Successfully uninstalled ref-2.0.0
Successfully uninstalled ruby-progressbar-1.9.0
Successfully uninstalled ruby_dep-1.5.0
Removing ruby_parse
Removing ruby_parse_extract_error
Successfully uninstalled ruby_parser-3.11.0
Successfully uninstalled rubyzip-1.2.2
Successfully uninstalled sass-3.5.6
Removing sass
Removing sass-convert
Removing scss
Successfully uninstalled sass-3.6.0
Successfully uninstalled sass-listen-4.0.0
Successfully uninstalled sass-rails-5.0.6
Successfully uninstalled sass-rails-5.0.7
ERROR: While executing gem ... (Gem::InstallError)
gem "scanf" cannot be uninstalled because it is a default gem
ERROR: While executing gem ... (Gem::InstallError)
gem "sdbm" cannot be uninstalled because it is a default gem
Successfully uninstalled selenium-webdriver-3.14.1
Successfully uninstalled sexp_processor-4.11.0
Successfully uninstalled shellany-0.0.1
Removing spring
Successfully uninstalled spring-2.0.2
Successfully uninstalled spring-watcher-listen-2.0.1
Removing sprockets
Successfully uninstalled sprockets-3.7.2
Successfully uninstalled sprockets-rails-3.2.1
Successfully uninstalled sqlite3-1.3.13
ERROR: While executing gem ... (Gem::InstallError)
gem "stringio" cannot be uninstalled because it is a default gem
ERROR: While executing gem ... (Gem::InstallError)
gem "strscan" cannot be uninstalled because it is a default gem
Successfully uninstalled temple-0.8.0
Successfully uninstalled test-unit-3.2.7
Successfully uninstalled therubyracer-0.12.3
Removing thor
Successfully uninstalled thor-0.20.0
Successfully uninstalled thread_safe-0.3.6
Removing tilt
Successfully uninstalled tilt-2.0.8
Successfully uninstalled turbolinks-5.0.1
Successfully uninstalled turbolinks-5.2.0
Successfully uninstalled turbolinks-source-5.1.0
Successfully uninstalled turbolinks-source-5.2.0
Successfully uninstalled tzinfo-1.2.5
Successfully uninstalled uglifier-3.2.0
Successfully uninstalled uglifier-4.1.19
Successfully uninstalled web-console-3.5.1
Successfully uninstalled web-console-3.7.0
ERROR: While executing gem ... (Gem::InstallError)
gem "webrick" cannot be uninstalled because it is a default gem
Successfully uninstalled websocket-driver-0.6.5
Successfully uninstalled websocket-driver-0.7.0
Successfully uninstalled websocket-extensions-0.1.3
Successfully uninstalled xmlrpc-0.3.0
Successfully uninstalled xpath-3.1.0
Removing yard
Removing yardoc
Removing yri
Successfully uninstalled yard-0.9.16
ERROR: While executing gem ... (Gem::InstallError)
gem "zlib" cannot be uninstalled because it is a default gem
*** LOCAL GEMS ***
bigdecimal (default: 1.3.4)
cmath (default: 1.0.0)
csv (default: 1.0.0)
date (default: 1.0.0)
dbm (default: 1.0.0)
etc (default: 1.0.0)
fcntl (default: 1.0.0)
fiddle (default: 1.0.0)
fileutils (default: 1.0.2)
gdbm (default: 2.0.0)
io-console (default: 0.4.6)
ipaddr (default: 1.2.0)
json (default: 2.1.0)
openssl (default: 2.1.0)
psych (default: 3.0.2)
rdoc (default: 6.0.1)
scanf (default: 1.0.0)
sdbm (default: 1.0.0)
stringio (default: 0.0.1)
strscan (default: 1.0.0)
webrick (default: 1.4.2)
zlib (default: 1.0.0)
Fetching: bundler-2.0.1.gem (100%)
Successfully installed bundler-2.0.1
1 gem installed
思ってたんと違う〜〜〜!!!!!!
・・・まぁええや。(雑)
全部を確認する
vagrant@ubuntu-xenial:~/tmp$ ruby -v
ruby 2.5.0p0 (2017-12-25 revision 61468) [x86_64-linux]
vagrant@ubuntu-xenial:~/tmp$ gem list
*** LOCAL GEMS ***
bigdecimal (default: 1.3.4)
bundler (2.0.1, default: 1.16.2)
cmath (default: 1.0.0)
csv (default: 1.0.0)
date (default: 1.0.0)
dbm (default: 1.0.0)
etc (default: 1.0.0)
fcntl (default: 1.0.0)
fiddle (default: 1.0.0)
fileutils (default: 1.0.2)
gdbm (default: 2.0.0)
io-console (default: 0.4.6)
ipaddr (default: 1.2.0)
json (default: 2.1.0)
openssl (default: 2.1.0)
psych (default: 3.0.2)
rdoc (default: 6.0.1)
scanf (default: 1.0.0)
sdbm (default: 1.0.0)
stringio (default: 0.0.1)
strscan (default: 1.0.0)
webrick (default: 1.4.2)
zlib (default: 1.0.0)
vagrant@ubuntu-xenial:~/tmp/sample_app$ ruby -v
ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-linux]
vagrant@ubuntu-xenial:~/tmp/sample_app$ gem list
*** LOCAL GEMS ***
bigdecimal (default: 1.3.0)
bundler (2.0.1)
io-console (default: 0.4.6)
json (default: 2.0.2)
openssl (default: 2.0.3)
psych (default: 2.2.2)
rdoc (default: 5.0.0)
vagrant@ubuntu-xenial:~/project$ ruby -v
ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-linux]
vagrant@ubuntu-xenial:~/project$ gem list
*** LOCAL GEMS ***
bigdecimal (default: 1.3.4)
bundler (2.0.1)
cmath (default: 1.0.0)
csv (default: 1.0.0)
date (default: 1.0.0)
dbm (default: 1.0.0)
etc (default: 1.0.0)
fcntl (default: 1.0.0)
fiddle (default: 1.0.0)
fileutils (default: 1.0.2)
gdbm (default: 2.0.0)
io-console (default: 0.4.6)
ipaddr (default: 1.2.0)
json (default: 2.1.0)
openssl (default: 2.1.0)
psych (default: 3.0.2)
rdoc (default: 6.0.1)
scanf (default: 1.0.0)
sdbm (default: 1.0.0)
stringio (default: 0.0.1)
strscan (default: 1.0.0)
webrick (default: 1.4.2)
zlib (default: 1.0.0)
2.5.0だけクリーンにするつもりが雑にスクリプト叩いたから他のRubyバージョンのgemも消してしまった。
しかもゴミはゴミで残ってるし・・・
誰か教えろください。
オワオワリ。
ガチで消すなら
それでも全部いったんまっさらにしたいよね。
vagrant@ubuntu-xenial:~/tmp/sample_app$ gem uninstall -aIx
Removing bundler
Successfully uninstalled bundler-2.0.1
INFO: Uninstalled all gems in
これでデフォルト以外のgemは全て消える。
デフォルトのgemを消したい場合は物理で殴りに行く。
ものによっては軽い気持ちでジャブ打ちに行くととんでもないクロスカウンター食らうので調べてからやるといいかも。
今回は遊びなのでやれるところまでとことんやる。
まず殺す相手を見つける。
vagrant@ubuntu-xenial:~/tmp/sample_app$ ls -la /home/vagrant/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/
total 32
drwxr-xr-x 6 vagrant vagrant 12288 Mar 26 22:28 .
drwxr-xr-x 8 vagrant vagrant 4096 Mar 11 23:27 ..
drwxrwxr-x 3 vagrant vagrant 4096 Jul 16 2018 bundler-1.16.2
drwxrwxr-x 4 vagrant vagrant 4096 Mar 2 15:27 ovirt-engine-sdk-4.2.5
drwxr-xr-x 3 vagrant vagrant 4096 Jul 7 2018 rdoc-6.0.1
実際に殺す。
vagrant@ubuntu-xenial:~/tmp/sample_app$ rm -rf /home/vagrant/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/ovirt-engine-sdk-4.2.5/
vagrant@ubuntu-xenial:~/tmp/sample_app$ rm -rf /home/vagrant/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/bundler-1.16.2/
vagrant@ubuntu-xenial:~/tmp/sample_app$ rm -rf /home/vagrant/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/rdoc-6.0.1/
vagrant@ubuntu-xenial:~/tmp/sample_app$ ls -la /home/vagrant/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/
total 16
drwxr-xr-x 2 vagrant vagrant 12288 Mar 27 00:06 .
drwxr-xr-x 8 vagrant vagrant 4096 Mar 11 23:27 ..
vagrant@ubuntu-xenial:~/tmp/sample_app$ gem list
*** LOCAL GEMS ***
bigdecimal (default: 1.3.4)
bundler (default: 1.16.2)
cmath (default: 1.0.0)
csv (default: 1.0.0)
date (default: 1.0.0)
dbm (default: 1.0.0)
etc (default: 1.0.0)
fcntl (default: 1.0.0)
fiddle (default: 1.0.0)
fileutils (default: 1.0.2)
gdbm (default: 2.0.0)
io-console (default: 0.4.6)
ipaddr (default: 1.2.0)
json (default: 2.1.0)
openssl (default: 2.1.0)
psych (default: 3.0.2)
rdoc (default: 6.0.1)
scanf (default: 1.0.0)
sdbm (default: 1.0.0)
stringio (default: 0.0.1)
strscan (default: 1.0.0)
webrick (default: 1.4.2)
zlib (default: 1.0.0)
消しても特に影響なし。
その後もちゃんとgem installできた。
vagrant@ubuntu-xenial:~/tmp/sample_app$ gem install bundler
Fetching: bundler-2.0.1.gem (100%)
Successfully installed bundler-2.0.1
1 gem installed
vagrant@ubuntu-xenial:~/tmp/sample_app$ bundle init
Writing new Gemfile to /home/vagrant/tmp/sample_app/Gemfile
vagrant@ubuntu-xenial:~/tmp/sample_app$ bundle install --path vendor/bundle
Fetching gem metadata from https://rubygems.org/.............
Fetching gem metadata from https://rubygems.org/.
Resolving dependencies...
Fetching rake 12.3.2
Installing rake 12.3.2
Fetching concurrent-ruby 1.1.5
Installing concurrent-ruby 1.1.5
Fetching i18n 1.6.0
Installing i18n 1.6.0
Fetching minitest 5.11.3
Installing minitest 5.11.3
Fetching thread_safe 0.3.6
Installing thread_safe 0.3.6
Fetching tzinfo 1.2.5
Installing tzinfo 1.2.5
Fetching activesupport 5.1.6
Installing activesupport 5.1.6
Fetching builder 3.2.3
Installing builder 3.2.3
Fetching erubi 1.8.0
Installing erubi 1.8.0
Fetching mini_portile2 2.4.0
Installing mini_portile2 2.4.0
Fetching nokogiri 1.10.2
Installing nokogiri 1.10.2 with native extensions
Fetching rails-dom-testing 2.0.3
Installing rails-dom-testing 2.0.3
Fetching crass 1.0.4
Installing crass 1.0.4
Fetching loofah 2.2.3
Installing loofah 2.2.3
Fetching rails-html-sanitizer 1.0.4
Installing rails-html-sanitizer 1.0.4
Fetching actionview 5.1.6
Installing actionview 5.1.6
Fetching rack 2.0.6
Installing rack 2.0.6
Fetching rack-test 1.1.0
Installing rack-test 1.1.0
Fetching actionpack 5.1.6
Installing actionpack 5.1.6
Fetching nio4r 2.3.1
Installing nio4r 2.3.1 with native extensions
Fetching websocket-extensions 0.1.3
Installing websocket-extensions 0.1.3
Fetching websocket-driver 0.6.5
Installing websocket-driver 0.6.5 with native extensions
Fetching actioncable 5.1.6
Installing actioncable 5.1.6
Fetching globalid 0.4.2
Installing globalid 0.4.2
Fetching activejob 5.1.6
Installing activejob 5.1.6
Fetching mini_mime 1.0.1
Installing mini_mime 1.0.1
Fetching mail 2.7.1
Installing mail 2.7.1
Fetching actionmailer 5.1.6
Installing actionmailer 5.1.6
Fetching activemodel 5.1.6
Installing activemodel 5.1.6
Fetching arel 8.0.0
Installing arel 8.0.0
Fetching activerecord 5.1.6
Installing activerecord 5.1.6
Using bundler 2.0.1
Fetching method_source 0.9.2
Installing method_source 0.9.2
Fetching thor 0.20.3
Installing thor 0.20.3
Fetching railties 5.1.6
Installing railties 5.1.6
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.1.6
Installing rails 5.1.6
Bundle complete! 1 Gemfile dependency, 38 gems now installed.
Gems in the group production were not installed.
Bundled gems are installed into `./vendor/bundle`
Post-install message from i18n:
HEADS UP! i18n 1.1 changed fallbacks to exclude default locale.
But that may break your application.
Please check your Rails app for 'config.i18n.fallbacks = true'.
If you're using I18n (>= 1.1.0) and Rails (< 5.2.2), this should be
'config.i18n.fallbacks = [I18n.default_locale]'.
If not, fallbacks will be broken in your app by I18n 1.1.x.
For more info see:
https://github.com/svenfuchs/i18n/releases/tag/v1.1.0
なんか怒られてるけどいけるんじゃないか?
指示通りにやったら怒られなくなった。