zsh: command not found: bundle (after gem install bundle)

Mark Boulder picture Mark Boulder · Jan 21, 2015 · Viewed 28.1k times · Source

Why zsh: command not found: bundle after gem install bundler?

I tried setting path=( /usr/local/lib/ruby/gems/2.2/gems/ ~/bin /bin /sbin /usr/bin /usr/sbin /usr/local/bin /usr/local/sbin ) in /etc/zshrc and source /etc/zshrc to no avail.

root@dev:/home/dev# gem install bundler
Successfully installed bundler-1.7.12
Parsing documentation for bundler-1.7.12
Done installing documentation for bundler after 10 seconds
1 gem installed

root@dev:/home/dev# bundle
zsh: command not found: bundle

root@dev:/home/dev# uname -a
OpenBSD dev.my.domain 5.7 GENERIC#748 amd64

root@dev:/home/dev# gem environment
RubyGems Environment:
  - RUBYGEMS VERSION: 2.4.5
  - RUBY VERSION: 2.2.0 (2014-12-25 patchlevel 0) [x86_64-openbsd]
  - INSTALLATION DIRECTORY: /usr/local/lib/ruby/gems/2.2
  - RUBY EXECUTABLE: /usr/local/bin/ruby22
  - EXECUTABLE DIRECTORY: /usr/local/bin
  - SPEC CACHE DIRECTORY: /root/.gem/specs
  - SYSTEM CONFIGURATION DIRECTORY: /etc
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86_64-openbsd
  - GEM PATHS:
     - /usr/local/lib/ruby/gems/2.2
     - /usr/local/lib/ruby/gems/2.2/gems/
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - https://rubygems.org/
  - SHELL PATH:
     - /usr/local/lib/ruby/gems/2.2/gems/
     - /root/bin
     - /bin
     - /sbin
     - /usr/bin
     - /usr/sbin
     - /usr/local/bin
     - /usr/local/sbin

Answer

Ricardo Rojas picture Ricardo Rojas · Dec 18, 2015

I had the same issue using zsh and this fixed it:

$ echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.zshenv
$ echo 'eval "$(rbenv init -)"' >> ~/.zshenv
$ echo 'source $HOME/.zshenv' >> ~/.zshrc
$ exec $SHELL