ruby 未找到捆绑命令 mac

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/29932409/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-06 06:43:02  来源:igfitidea点击:

Bundle command not found mac

rubymacosbundler

提问by ytk

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

我正在使用 ruby​​,我得到了一个包含一些 ruby​​ 程序的 zip 文件,它说:在文件夹内,运行bundle install以安装所需的包。

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

当我在终端中运行命令时,它显示bundle command not found.

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

有人可以给我详细说明如何解决这个问题吗?

回答by B Seven

gem install bundler

is how to do it.

是怎么做的。

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

您可能希望使用rbenv 之类的工具来管理 gem。

回答by MikeiLL

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

只是为那些(至少在 OSX 上)为谁重申这一点

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

给出一个权限错误,一个似乎对很多人都有效的选项是使用rbenv,它会在你的 ruby​​ 命令(如gem install)和你的环境(如果我的理解是正确的)之间添加一个垫片。

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:

然后你必须在你的配置文件中添加一个参数命令,如果你使用的是 common ~/.bash_profile,可以通过以下方式完成:

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

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

它看起来像是添加一个命令来通过你的 shell 初始化 rbenv。

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

不要为了开始一个新的 shell,可能是通过打开一个新终端或使用source ~/.bash_profile命令。

Make sure your $PATHhas this .rbenv/shimsBEFORE 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.

请确保您$PATH有此.rbenv/shims之前您的外壳可能会寻找红宝石(OSX,用它自己的版本,我们不想与小提琴)任何其他目录:echo $PATH

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

Now install a version of Ruby:

现在安装一个 Ruby 版本:

rbenv install 2.2.3 

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

(查看所有可能的版本,带有rbenv install -l)。

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

现在我们可以使用rbenv global 2.2.3全局切换到使用较新版本的 Ruby。(嗯,我还以为我们希望与系统版本混乱。)您也可以与尝试rbenv local 2.2.3rbenv shell 2.2.3

Finally run:

最后运行:

rbenv rehash

Now ruby -vshould return 2.2.3and gem install bundlershould work.

现在ruby -v应该返回2.2.3并且gem install bundler应该工作。

Did here.

在这里做了。

回答by xcodebuild

Just run gem install bundlerin your terminal.

只需gem install bundler在您的终端中运行即可。

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

有一个链接bundler你可以看看:bundler

回答by shushugah

Some ruby version managers like chruby and rbenv store gems separately for each version, so when you install a different version of ruby, you'll need to gem install bundler.

一些 ruby​​ 版本管理器,如 chruby 和 rbenv 分别为每个版本存储 gem,所以当你安装不同版本的 ruby​​ 时,你需要gem install bundler.

回答by Stan666

Tried every solution here but didn't work out. Eventually I got this to work in two different methods:

在这里尝试了所有解决方案,但没有奏效。最终我让它以两种不同的方法工作:

  • Set alias bundle=/path/to/bundlein .bashrcif you don't care the nastiness.
  • Recreate a fresh dev env via rbenvand do bundle install railswill fix it (fixed my issue).
  • 设置alias bundle=/path/to/bundle.bashrc,如果你不在乎污秽。
  • 通过重新创建一个新的开发环境rbenv并执行bundle install rails将修复它(修复了我的问题)。

回答by Anonymous

Terminal -

终端 -

sudo su 

then your password:

那么你的密码:

change directory :

更改目录:

cd command . 

if you do not have permissions to write to drive.

如果您没有写入驱动器的权限。

chmod 755 foldername. 

And you can also mkdir command in terminal

你也可以在终端中使用 mkdir 命令

mkdir /Library/Ruby/Gems/2.3.0.1

copy and paste: gem install bundlerpaste to the terminal.

复制粘贴:gem install bundler粘贴到终端。

Fetching: bundler-1.16.2.gem (100%)
bundler's executable "bundle" conflicts with /usr/local/bin/bundle
Overwrite the executable? [yN]  y
bundler's executable "bundler" conflicts with /usr/local/bin/bundler
Overwrite the executable? [yN]  y
Successfully installed bundler-1.16.2
Parsing documentation for bundler-1.16.2
Installing ri documentation for bundler-1.16.2
Done installing documentation for bundler after 7 seconds
1 gem installed

works for OS X High Sierra.

适用于 OS X High Sierra。