简体   繁体   English

如何在OS X 10.5.4下安装mysql ruby​​ gem

[英]How do I install the mysql ruby gem under OS X 10.5.4

Here is the deal. 这是交易。

$ gem --version $ gem --version

1.1.0 1.1.0

$ sudo gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config $ sudo gem install mysql - --with-mysql-config = / usr / local / mysql / bin / mysql_config

Bulk updating Gem source index for: http://gems.rubyforge.org/ ERROR: could not find mysql locally or in a repository 批量更新Gem源索引: http//gems.rubyforge.org/错误:无法在本地或存储库中找到mysql

$ sudo gem update $ sudo gem update

Updating installed gems Bulk updating Gem source index for: http://gems.rubyforge.org/ 更新已安装的宝石批量更新宝石源索引: http//gems.rubyforge.org/

Updating RedCloth ERROR: While executing gem ... (Gem::GemNotFoundException) could not find RedCloth locally or in a repository 更新RedCloth错误:执行gem时...(Gem :: GemNotFoundException)无法在本地或存储库中找到RedCloth

I've tried this , this , this , this , and a ton of others. 我试过这个这个这个这个 ,一吨他人。

None of them have worked for me. 他们都没有为我工作。 Is anyone else having this problem? 还有其他人有这个问题吗? If so what did you do to fix it that is not mentioned above? 如果是这样你做了什么修复它,上面没有提到?

First of all as Orion Edwards said make sure you have rubygems 1.2. 首先,猎户座爱德华兹说,确保你有rubygems 1.2。 Unfortunately, 不幸,

gem update --system gem update --system

did not work for me. 不适合我。

Instead I had to: 相反,我不得不:

  1. Manually download rubygems-update-1.2.0 from rubyforge. 从rubyforge手动下载rubygems-update-1.2.0
  2. $ sudo gem install /path/to/rubygems-update-1.2.0.gem $ sudo gem install /path/to/rubygems-update-1.2.0.gem
  3. $ update_rubygems $ update_rubygems

Now that I had rubygems 1.2 I ran 现在我有rubygems 1.2我跑了

$ sudo gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config $ sudo gem install mysql - --with-mysql-config = / usr / local / mysql / bin / mysql_config

Everything is working. 一切正常。 Thanks Orion Edwards for steering me in the right direction. 感谢Orion Edwards指导我朝着正确的方向前进。

Step 1 第1步

gem update --system

It probably won't provide the fix itself, but You really want rubygems 1.2. 它可能不会提供修复本身,但你真的想要rubygems 1.2。 It will save you about 8 days waiting as it doesn't need to do the 'Bulk updating 102304 gems' rubbish any more 它将为您节省大约8天的时间,因为它不再需要“批量更新102304宝石”垃圾

It actually looks like it can't find the mysql gem at all, let alone download or install it. 它实际上看起来根本找不到mysql gem,更不用说下载或安装了它。 You're not behind a proxy server or something weird like that? 你不是在代理服务器之后或类似的东西?

If it's something to do with your rubygems or the net, rather than mysql specifically, then the gem update --system should reveal it too 如果它与你的rubygems或网络有关,而不是具体的mysql,那么gem update --system也应该揭示它

Installing XCode solved this problem for me. 安装XCode为我解决了这个问题。

This is because it includes the make and gcc tools, which are required by the gem. 这是因为它包含了gem所需的make和gcc工具。

Ryan Grove has a blog post with the answer: Ryan Grove有一篇博文 ,答案如下:

sudo env ARCHFLAGS="-arch i386" gem install mysql -- \
  --with-mysql-dir=/usr/local/mysql --with-mysql-lib=/usr/local/mysql/lib \
  --with-mysql-include=/usr/local/mysql/include

Do you have different ruby versions on your system? 你的系统上有不同的ruby版本吗? If you're running the Darwin-supplied ruby binary, but installed ruby gems under /usr/local, then you'll get errors like this. 如果您正在运行Darwin提供的ruby二进制文件,但在/ usr / local下安装了ruby gems,那么您将收到这样的错误。 Even if you've aliased ruby to point to /usr/local, the gem command may fail if the proper ruby binary is not resolved correctly by your shell's $PATH. 即使你将ruby别名指向/ usr / local,如果shell的$ PATH没有正确解析正确的ruby二进制文件,gem命令可能会失败。 Also, if /usr/local/bin is located physically after /usr/bin in your path, gem will use /usr/bin/ruby to load the gems from /Library/Ruby/Gems/1.8/gems/. 此外,如果/ usr / local / bin位于路径中的/ usr / bin之后,gem将使用/ usr / bin / ruby​​从/Library/Ruby/Gems/1.8/gems/加载gem。 You may want to symlink /usr/lib/ruby/gems/1.8/gems to /Library/Ruby/Gems/1.8/gems/ to prevent this sort of thing. 您可能希望将/usr/lib/ruby/gems/1.8/gems符号链接到/Library/Ruby/Gems/1.8/gems/以防止此类事情发生。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM