Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bundle command not found mac

I'm using ruby, and I was given a zip file with some ruby programs and it says: inside the folder, run bundle install to install the packages required.

When I run the command in my terminal, it says bundle command not found.

Can someone please give me a detailed description of how I can fix this?

like image 229
ytk Avatar asked Apr 29 '15 00:04

ytk


People also ask

What is the bundle command?

The bundle exec command ensures that executable programs installed by Gems don't interfere with your app's requirements. For instance, if your app needs a specific version of rake but the default version of rake differs, bundle exec ensures that you can still run the specific rake version compatible with your app.

What is bundle exec command?

bundle exec is a Bundler command to execute a script in the context of the current bundle (the one from your directory's Gemfile). rake db:migrate is the script where db is the namespace and migrate is the task name defined.


3 Answers

gem install bundler

is how to do it.

You may want to use a tool such as rbenv to manage gems.

like image 128
B Seven Avatar answered Oct 10 '22 19:10

B Seven


Just reiterating that for those (at least on OSX) for whom

gem install bundler

Gives a permissions error, an option that seems to have worked for many people is to use rbenv, which kind of adds a shim between your ruby commands (like gem install) and your environment (if my understanding is correct).

Definitely check out this answer.

The process is laid out fairly well under the above link. I chose to install via homebrew:

brew update
brew install rbenv

Then you have to add an argument command to your profile, which if you're using the common ~/.bash_profile, can be done with:

echo 'eval "$(rbenv init -)"' >> ~/.bash_profile

Which it looks like is adding a command to initialize rbenv via your shell.

Don't for get to start a new shell, possibly by opening a new terminal or using the source ~/.bash_profile command.

Make sure your $PATH has this .rbenv/shims BEFORE any other directory where your shell might be looking for Ruby (OSX comes with it's own version that we don't want to fiddle with): echo $PATH.

which ruby
/Users/mikekilmer/.rbenv/shims/ruby
#GOOD!

Now install a version of Ruby:

rbenv install 2.2.3 

(See all possible versions with rbenv install -l).

Now we can use rbenv global 2.2.3 to switch to a use the newer version of Ruby globally. (Hmm. I thought we didn't want to mess with the system version.) You could also try it with rbenv local 2.2.3 or rbenv shell 2.2.3.

Finally run:

rbenv rehash

Now ruby -v should return 2.2.3 and gem install bundler should work.

Did here.

like image 55
MikeiLL Avatar answered Oct 10 '22 20:10

MikeiLL


Just run gem install bundler in your terminal.

There is a link to bundler you can take a look:bundler

like image 7
xcodebuild Avatar answered Oct 10 '22 19:10

xcodebuild