33
36

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.

gem install経由のbundlerがcommand not foundになった時の対処

Posted at

bundlerに限らずgem installでインストールしたのにcommand not foundになってしまった時の対処です。

インストールは問題なく成功

$ gem install bundler
Fetching: bundler-1.7.2.gem (100%)
Successfully installed bundler-1.7.2
Parsing documentation for bundler-1.7.2
Installing ri documentation for bundler-1.7.2
Done installing documentation for bundler after 6 seconds
1 gem installed

いざコマンドを実行してみると・・・

$ bundle install
-bash: bundle: command not found

PATHが通ってないかと確認すると、以下の通りの状況。

$ gem contents bundler | grep bin
/Users/user/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/bundler-1.7.2/bin/bundle

$ echo $PATH
/Users/user/.rbenv/bin:/Users/user/.rbenv/shims:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin
$ ls $HOME/.rbenv/shims
berks			chef-solo		ffi-yajl-bench		ldiff			rake			shef
chef-apply		chef-zero		gem			minitar			rdoc			testrb
chef-client		coderay			htmldiff		ohai			restclient		thor
chef-service-manager	erb			irb			pry			ri
chef-shell		erubis			knife			rackup			ruby

はい、そうです。rbenvを使用しているのにrehashしていないだけです。
意外と忘れがちで、気づきづらいのでメモしておきます。

$ rbenv rehash 
$ ls $HOME/.rbenv/shims
berks			chef-service-manager	erb			irb			pry			ri
bundle			chef-shell		erubis			knife			rackup			ruby
bundler			chef-solo		ffi-yajl-bench		ldiff			rake			shef
chef-apply		chef-zero		gem			minitar			rdoc			testrb
chef-client		coderay			htmldiff		ohai			restclient		thor
33
36
1

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
33
36

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?