Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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 
like image 666
Mark Boulder Avatar asked Jan 21 '15 16:01

Mark Boulder


People also ask

What is the difference between gem install and bundle install?

Almost seems like running 'gem install' adds it to the global available gems (and hence terminal can run the package's commands), whereas adding it to the gemfile and running bundle install only adds it to the application. Similar to npm install --global. that's basically it.

Where does bundle install gems to?

Show activity on this post. I know that when using gem install , the gem will be stored under /home/username/. rvm/gems/, under which gemset the gem was installed.

How do I get Gemfile?

A gemfile is automatically created when you start a new rails application. type rails new appName and then it will be generated automatically. It will also be populated with some gems.


Video Answer


2 Answers

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 
like image 125
Ricardo Rojas Avatar answered Oct 02 '22 17:10

Ricardo Rojas


You seem to be after installing bundler system-wide. To do this, you need to pass --no-user-install flag to gem and execute it with sudo:

sudo gem install bundler --no-user-install 

After this, you should see bundle in /usr/bin/ just fine:

$ ls /usr/bin/bundle /usr/bin/bundle* 
like image 31
rr- Avatar answered Oct 02 '22 15:10

rr-