ERROR: Gem bundler is not installed, run `gem install bundler` first
I think this is the problem: You have bundler installed to a specific gemset, which is why it's only available when you're in your app's directory (I'm assuming there's a .rvmrc
file in there).
You have a few options:
- Install
bundler
to a global gemset.rvm gemset use global && gem install bundler
- If you have Homebrew installed, just do
brew install ruby
and avoid rvm altogether. (There's also rbenv and ry as alternatives to rvm, but I just use 1.9.3 across all my apps, so Homebrew is fine.)
For reference, $PATH
is a shell environmental variable containing a list of directories that hold executables (e.g., echo
, ls
, vim
, etc.). It's intrinsic to shells.
Ruby: gem install bundler not installing bundler
I can confirm this is happening in a fresh rvm install of Linux Mint. I'm using gnome-terminal and I have applied the "Run command as login shell" workaround. I'm using ruby 1.9.3 and haven't done anything with gemsets. When I type 'gem list' I see all the rubies I've installed (the first hour I got rvm installed, I playing around installing some projects and it seemed to be in perfect working order).
It looks like adding
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"
to ~/.bashrc clears up the inconsistency problems. It's odd that it was working fine initially without it... And it should only be sourcing .bash_login in the first place...
gem install bundler not working?
Try updating your certs.
$ curl http://curl.haxx.se/ca/cacert.pem \
> $(ruby -ropenssl -e 'puts OpenSSL::X509::DEFAULT_CERT_FILE')
Credit here: http://ga.be/blog/2013/10/02/fixing-rubygems-ssl-issues-certificate-verify-failed/
If you run into other issues building from source, you may want to try ruby-build
which is terrific IMHO because it downloads the various dependencies easily.
how to fix ruby bundle install error?
Apparently there was an issue with bundler, here's how this worked out for me:
- cleanup by running
gem cleanup bundler
- reinstall bundler via
gem install bundler
Error installing Bundler
Had the same issue and everything is described here: http://railsapps.github.io/openssl-certificate-verify-failed.html
tl;dr Recent versions of RVM, the Ruby Version Manager, include a utility to diagnose and resolve errors caused by outdated certificate files. See the article Installing Rails for instructions and advice. The RVM website explains how to install RVM.
If you’ve installed RVM, try this:
$ rvm -v
# rvm 1.19.1 (stable)
$ rvm osx-ssl-certs status all
# Certificates for...
$ rvm osx-ssl-certs update all
# Updating certificates...
That’s all that is needed to resolve the issue if you are using RVM (you must be using RVM version 1.19.1 or newer).
Problem installing bundler, Says it installs, but then doesn't actually install
rbenv works by inserting a directory of shims at the front of your PATH:
~/.rbenv/shims:/usr/local/bin:/usr/bin:/bin
Through a process called rehashing, rbenv maintains shims in that directory to match every Ruby command across every installed version of Ruby—irb, gem, rake, rails, ruby, and so on.
Shims are lightweight executables that simply pass your command along to rbenv. So with rbenv installed, when you run, say, rake, your operating system will do the following:
- Search your
PATH
for an executable file named rake- Find the rbenv shim named rake at the beginning of your
PATH
- Run the shim named
rake
, which in turn passes the command along to rbenv
You messed up your rbenv
installation.
1) Remove ruby installation outside rbenv
2) rvm implode
3) Clean up your $PATH
env variable from ~/.bash_profile
or ~/.bashrc
Remove any $PATH
reference pointing to ruby
, irb
, gem
or any folder including those bin executable. Consider commenting any $PATH
statement from your bash_profile
# export PATH="$HOME/etc/bin:$PATH"
# leave the statement below
# export PATH="$HOME/.rbenv/bin:$PATH
The $PATH
variable includes a list of folders:
echo $PATH
home/fabrizio/.rbenv/shims:/opt/android-studio/bin:~/.scripts/bin
if you run gem
in your terminal
any .bin
executable file included in home/fabrizio/.rbenv/shims
or /opt/android-studio/bin
is executable from any location in the terminal. When you run gem
, the ruby
gem command is executed instead of being intercepted from rbenv, because you installed ruby outside of rbenv.
UPDATE BASED ON YOUR FEEDBACK
You must have followed this step when installing ruby 2.5.0 without rbenv so remove from your ~/.bash_profile
or ~/.bashrc
the following line
PATH="$PATH:$(ruby -e 'puts Gem.user_dir')/bin"
or any other line which is adding /Users/brianp/.gem/ruby/2.5.0/bin
to your $PATH
, then uninstall ruby with apt.
Read the following information, additionally always check the location where gems are being installed with gem env:
$ gem env home
# => ~/.rbenv/versions/<ruby-version>/lib/ruby/gems/...
if the location from anywhere in the terminal is not under ~/.rbenv/
then you are installing the gems in the wrong locations.
LAST RESORT
Delete the gem folder with rm -rf ~/.gem
, a similar approach to this post if you can not remove /Users/brianp/.gem/ruby/2.5.0/bin
from your $PATH
SOLUTION FOR YOUR LAST ERROR
This error is caused from installing bundler 2.0
can't find gem bundler (>= 0.a) with executable bundle (Gem::GemNotFoundException)
you need to remove bundler 2.0
and install 1.9.0
Related Topics
Best Practices For Reusing Code Between Controllers in Ruby on Rails
Unresolved Specs During Gem::Specification.Reset:
How to Switch to Ruby 1.9.3 Installed Using Homebrew
Why Can't I Install Rails on Lion Using Rvm
Convert Time from One Time Zone to Another in Rails
Find Key/Value Pairs Deep Inside a Hash Containing an Arbitrary Number of Nested Hashes and Arrays
How to Deal With the Sum of Rounded Percentage Not Being 100
Ruby Regular Expression to Match a Url
How to Clear the Terminal in Ruby
Rails4 Unknown Encoding Name - Cp720
What Is the Use of Gemfile in Rails
How to Use Global Variables or Constant Values in Ruby
Find Unused Code in a Rails App
Rails Console: Reload! Not Reflecting Changes in Model Files? What Could Be Possible Reason