Hi I've been having a probably trying to install the Ruby gem bundle. I follow the directions gem install bundle
after I receive this message, but it still doesn't work when I type bundle -v
. I also type
which bundle
and receive
/Users/edmundmai/.rvm/bin/bundle
so it exists!! So why does it not work!! Is there something wrong with the mysterious $PATH that I don't get? (I'm a noob).
Here's my .bash_profile:
PATH=$PATH:~/bin export PATH [[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function* [[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function
Here's my .bashrc :
PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting [[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
Here's my gem env:
RubyGems Environment: - RUBYGEMS VERSION: 1.8.24 - RUBY VERSION: 1.9.3 (2012-04-20 patchlevel 194) [x86_64-darwin11.3.1] - INSTALLATION DIRECTORY: /Users/edmundmai/.rvm/gems/ruby-1.9.3-p194@rails3tutorial2ndEd - RUBY EXECUTABLE: /Users/edmundmai/.rvm/rubies/ruby-1.9.3-p194/bin/ruby - EXECUTABLE DIRECTORY: /Users/edmundmai/.rvm/gems/ruby-1.9.3-p194@rails3tutorial2ndEd/bin - RUBYGEMS PLATFORMS: - ruby - x86_64-darwin-11 - GEM PATHS: - /Users/edmundmai/.rvm/gems/ruby-1.9.3-p194@rails3tutorial2ndEd - /Users/edmundmai/.rvm/gems/ruby-1.9.3-p194@global - GEM CONFIGURATION: - :update_sources => true - :verbose => true - :benchmark => false - :backtrace => false - :bulk_threshold => 1000 - "install" => "--no-rdoc --no-ri" - "update" => "--no-rdoc --no-ri" - REMOTE SOURCES: - http://rubygems.org/
echo $PATH
/Users/edmundmai/.rvm/bin:/Users/edmundmai/.rvm/gems/ruby-1.9.3-p194@rails3tutorial2ndEd/bin:/Users/edmundmai/.rvm/gems/ruby-1.9.3-p194@global/bin:/Users/edmundmai/.rvm/rubies/ruby-1.9.3-p194/bin:/Users/edmundmai/.rvm/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/Users/edmundmai/bin:/Users/edmundmai/bin
UPDATE So after trying to go through the RoR tutorial again, I repeated a few of the steps from earlier in the chapter in one of my two terminal windows (let's call them Terminal #1 and Terminal #2). Terminal #2 still doesn't work (the command line isn't on any directory, just the default directory) while Terminal #1 (at my sample_app directory) works. I think rvm get head && rvm reload
might be the key? But does that mean I have to run that every time I open my terminal? Check out my terminal #1 commands for before and after (I deleted some of the output so that it would be more clear what my input lines were):
Edmunds-MacBook-Pro:sample_app edmundmai$ bundle -v ERROR: Gem bundler is not installed, run `gem install bundler` first. Edmunds-MacBook-Pro:sample_app edmundmai$ gem install ERROR: While executing gem ... (Gem::CommandLineError) Please specify at least one gem name (e.g. gem build GEMNAME) Edmunds-MacBook-Pro:sample_app edmundmai$ rvm -v rvm 1.15.8 (master) by Wayne E. Seguin <[email protected]>, Michal Papis <[email protected]> [https://rvm.io/] Edmunds-MacBook-Pro:sample_app edmundmai$ rspec spec/ No DRb server is running. Running in local process instead ... ........ Finished in 0.36709 seconds 8 examples, 0 failures Randomized with seed 59500 Edmunds-MacBook-Pro:sample_app edmundmai$ subl . Edmunds-MacBook-Pro:sample_app edmundmai$ bundle install --binstubs=./bundler_stubs Using rake (0.9.2.2) ... ... (**list of stuff) Using uglifier (1.2.3) Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed. Edmunds-MacBook-Pro:sample_app edmundmai$ bundle show bundler /Users/edmundmai/.rvm/gems/ruby-1.9.3-p194@rails3tutorial2ndEd/gems/bundler-1.2.0
I'm extremely unclear as to what the $PATH does. If you guys need any more info, feel free to tell me and I'll provide it.
I know that when using gem install , the gem will be stored under /home/username/. rvm/gems/, under which gemset the gem was installed.
Bundler provides a consistent environment for Ruby projects by tracking and installing the exact gems and versions that are needed. Bundler is an exit from dependency hell, and ensures that the gems you need are present in development, staging, and production. Starting work on a project is as simple as bundle install .
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:
bundler
to a global gemset. rvm gemset use global && gem install bundler
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With