27
votes

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..

1
Did you gem install bundler? - Dave Newton
yes, I've run gem install bundler. I'm using Ruby that came pre-installed on my mac. However, I also believe there is another interpreter installed at another location. When I type 'which ruby', 'which gem' and 'which rails' all go the /usr/bin/ directory - john john
Is bundler some kind of executable file? I noticed that my bundle-0.0.1 folder is empty. - john john
Please show output of commands gem env and echo $PATH. Probably, gem executable directory is not in your $PATH. - taro
I added the gem env and path info to my original post. I feel something fishy is going on because for some reason, there are two ruby interperters on this mac. - john john

1 Answers

50
votes

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 :)