Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

bundle: command not found on mac

I am trying to create a brand new Rails application and it is asking me to run 'bundle install'. However, whenever I do this I get a command not found error.

My path has both ruby and the gem folder on it. Is bundle a executable file? Where is it commonly stored?

I think it could be a path issue, with multiple Ruby versions installed.

Path: /usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin:/usr/X11/bin

gem env:

RubyGems Environment: RUBYGEMS VERSION: 1.8.10 RUBY VERSION: 1.8.7 (2010-01-10 patchlevel 249) [universal-darwin10.0] INSTALLATION DIRECTORY: /Library/Ruby/Gems/1.8 RUBY EXECUTABLE: /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby EXECUTABLE DIRECTORY: /usr/bin RUBYGEMS PLATFORMS: - ruby  - universal-darwin-10 GEM PATHS:  - /Library/Ruby/Gems/1.8  - /Users/john/.gem/ruby/1.8  - /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8 GEM CONFIGURATION:  - :update_sources => true  - :verbose => true  - :benchmark => false  - :backtrace => false  - :bulk_threshold => 1000  REMOTE SOURCES:  - http://rubygems.org/ 

which ruby returns /usr/bin/ruby

I think the ruby executable gem is trying to run is not pointing to the right place..

like image 472
john john Avatar asked Nov 26 '11 04:11

john john


1 Answers

I had a similar issue, and the following worked for me:

  • install bundler: gem install bundler
  • add the gems executable to my path

To add gem to the path, compare the following:

  • echo $PATH
  • which gem

if the gem executable is not in your path, then add it to your ~/.bash_profile by editing the line: export PATH="$PATH:/usr/local/var/rbenv/shims/gem"

In my example above, the existing path is referenced by $PATH, and I've pasted the location returned by which gem, separated by a colon :

I'm on a OSX 10.8.3 and gem was installed via homebrew. my path has a bunch of additions, so it looks like:

export PATH="/usr/local/bin:/usr/local/sbin:/usr/local/share/npm/bin:~/bin:/usr/local/var/rbenv/shims/gem:$PATH"

Each path is separated by a colon, and the $PATH variable sits at the end. not sure if it matters :)

like image 56
ptim Avatar answered Oct 02 '22 15:10

ptim