Search code examples
rubyruby-on-rails-4installationbundle

Rails: I installed Ruby, now "bundle install" doesn't work


I’m using Rails 4.2.7. I downloaded an example that evidently requires me to use Ruby 2.1.6 rather than the Ruby 2.3.0 version I had installed …

localhost:lti_tool_provider_example-master davea$ bundle install
Your Ruby version is 2.3.0, but your Gemfile specified 2.1.6

So that’s what I did. However after installing Ruby 2.1.6, now “bundle install” doesn’t work …

localhost:lti_tool_provider_example-master davea$ rvm install ruby-2.1.6
Warning! PATH is not properly set up, '/Users/davea/.rvm/gems/ruby-2.3.0/bin' is not at first place,
         usually this is caused by shell initialization files - check them for 'PATH=...' entries,
         it might also help to re-add RVM to your dotfiles: 'rvm get stable --auto-dotfiles',
         to fix temporarily in this shell session run: 'rvm use ruby-2.3.0'.
Warning, new version of rvm available '1.27.0', you are using older version '1.26.11'.
You can disable this warning with:    echo rvm_autoupdate_flag=0 >> ~/.rvmrc
You can enable  auto-update  with:    echo rvm_autoupdate_flag=2 >> ~/.rvmrc
Searching for binary rubies, this might take some time.
Found remote file https://rubies.travis-ci.org/osx/10.12/x86_64/ruby-2.1.6.tar.bz2
Checking requirements for osx.
Certificates in '/usr/local/etc/openssl/cert.pem' are already up to date.
Requirements installation successful.
ruby-2.1.6 - #configure
ruby-2.1.6 - #download
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100 7630k  100 7630k    0     0  1199k      0  0:00:06  0:00:06 --:--:-- 1551k
No checksum for downloaded archive, recording checksum in user configuration.
ruby-2.1.6 - #validate archive
ruby-2.1.6 - #extract
ruby-2.1.6 - #validate binary
Libraries missing for ruby-2.1.6: cannot. Refer to your system manual for installing libraries
Mounting remote ruby failed with status 10, trying to compile.
Checking requirements for osx.
Certificates in '/usr/local/etc/openssl/cert.pem' are already up to date.
Requirements installation successful.
Warning: DYLD_LIBRARY_PATH environment variable is set, this might interact with the compilation and ruby.
Installing Ruby from source to: /Users/davea/.rvm/rubies/ruby-2.1.6, this may take a while depending on your cpu(s)...
ruby-2.1.6 - #downloading ruby-2.1.6, this may take a while depending on your connection...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 11.4M  100 11.4M    0     0  2272k      0  0:00:05  0:00:05 --:--:-- 2354k
No checksum for downloaded archive, recording checksum in user configuration.
ruby-2.1.6 - #extracting ruby-2.1.6 to /Users/davea/.rvm/src/ruby-2.1.6....
ruby-2.1.6 - #configuring....................................................
ruby-2.1.6 - #post-configuration.
ruby-2.1.6 -    #compiling.......................................................................................................................................
ruby-2.1.6 - #installing...............
ruby-2.1.6 - #making binaries executable..
ruby-2.1.6 - #downloading rubygems-2.4.8
ruby-2.1.6 - #extracting rubygems-2.4.8.....
ruby-2.1.6 - #removing old rubygems.........
ruby-2.1.6 - #installing rubygems-2.4.8......................
ruby-2.1.6 - #gemset created /Users/davea/.rvm/gems/ruby-2.1.6@global
ruby-2.1.6 - #importing gemset /Users/davea/.rvm/gemsets/global.gems...............................................
ruby-2.1.6 - #generating global wrappers........
ruby-2.1.6 - #gemset created /Users/davea/.rvm/gems/ruby-2.1.6
ruby-2.1.6 - #importing gemsetfile /Users/davea/.rvm/gemsets/default.gems evaluated to empty gem list
ruby-2.1.6 - #generating default wrappers........
ruby-2.1.6 - #adjusting #shebangs for (gem irb erb ri rdoc testrb rake).
Install of ruby-2.1.6 - #complete 
Ruby was built without documentation, to build it run: rvm docs generate-ri
localhost:lti_tool_provider_example-master davea$ bundle install
-bash: bundle: command not found

How do I restore the “bundle” command without interfering with the Ruby 2.1.3 version I just installed?


Solution

  • Bundle with Ruby 2.1.6

    You just need to install bundler :

    rvm use ruby-2.1.6
    gem install bundler
    

    This will be installed in a gemset specific to ruby-2.1.6, so it won't interfere with anything you installed with ruby-2.3.0. You can use

    bundle install
    

    to install the required gems.

    Trying with Ruby 2.3.0

    Alternatively, you could just try the example you downloaded with ruby-2.3.0 by either changing the

    ruby '2.1.6'
    

    line or deleting it from the Gemfile.