简体   繁体   English

如何在没有Xcode的情况下在Mac OS X Mountain Lion中安装Ruby 1.9.3?

[英]How can I install Ruby 1.9.3 in Mac OS X Mountain Lion without Xcode?

I would like to know about alternative ways to build a development machine for Ruby 1.9.3 on OS X 10.8 Mountain Lion, that does not require Xcode. 我想知道在OS X 10.8 Mountain Lion上为Ruby 1.9.3构建开发机器的替代方法,它不需要Xcode。

Mountain Lion is now Golden Master as I'm writing this question, so it could be considered as final version. Mountain Lion现在是Golden Master,因为我正在写这个问题,所以它可以被认为是最终版本。 That cannot be said about Xcode, that is a preview release yet. 关于Xcode,这是一个预览版本。

RVM recommends to install osx-gcc-installer over Xcode, but I would like not to mess my system. RVM建议在Xcode上安装osx-gcc-installer,但我不想弄乱我的系统。

What is the cleanest way to install Ruby 1.9.3 on Mountain Lion without Xcode? 在没有Xcode的情况下在Mountain Lion上安装Ruby 1.9.3的最简洁方法是什么?

osx-gcc-installer turns out to be a very good option to replace Xcode in order to install Ruby 1.9.3 osx-gcc-installer被证明是替换Xcode以安装Ruby 1.9.3的一个非常好的选择

These are the steps I have followed: 这些是我遵循的步骤:

  1. Download & install the latest version of osx-gcc-installer here (GCC-10.7-v2 is fine): https://github.com/kennethreitz/osx-gcc-installer 在这里下载并安装最新版本的osx-gcc-installer(GCC-10.7-v2很好): https//github.com/kennethreitz/osx-gcc-installer
  2. Install RVM as usual and select 1.9.3-head as the default ruby installation: https://rvm.io/rvm/install/ 像往常一样安装RVM并选择1.9.3-head作为默认的ruby安装: https//rvm.io/rvm/install/
  3. Install Homebrew: https://github.com/mxcl/homebrew/wiki/installation 安装Homebrew: https//github.com/mxcl/homebrew/wiki/installation
  4. Install libksba to resolve some dependencies with Ruby 1.9.3: brew install libksba 安装libksba以解决Ruby 1.9.3的一些依赖关系: brew install libksba

That's it! 而已! You should now have Ruby 1.9.3 installed on Mountain Lion working perfectly. 您现在应该在Mountain Lion上安装Ruby 1.9.3。

If you need some other packages, install them now through Homebrew, such as Imagemagick for example: brew install imagemagick 如果您需要其他软件包,请立即通过Homebrew安装它们,例如Imagemagick: brew install imagemagick

It's possible that you need XQuartz for Homebrew to work properly, as Apple is not shipping X11 since Mountain Lion. 您可能需要XQuartz for Homebrew才能正常工作,因为Apple从Mountain Lion开始不提供X11。 You can download it here: http://xquartz.macosforge.org/trac/wiki 您可以在此处下载: http//xquartz.macosforge.org/trac/wiki

EDIT: 编辑:

Now (since 29th July) Command line tools for Xcode 4.4 are available. 现在(自7月29日起)可以使用Xcode 4.4的命令行工具。

So, the new steps are these: 所以,新的步骤是这些:

  1. Download & install Command line tools for Xcode 4.4 (you don't need to download Xcode): https://developer.apple.com/downloads/index.action 下载并安装Xcode 4.4的命令行工具(您无需下载Xcode): https//developer.apple.com/downloads/index.action
  2. Install Homebrew: https://github.com/mxcl/homebrew/wiki/installation 安装Homebrew: https//github.com/mxcl/homebrew/wiki/installation
  3. Install automake: brew install automake 安装automake: brew install automake
  4. Install RVM as usual and select 1.9.3-head as the default ruby installation: https://rvm.io/rvm/install/ 像往常一样安装RVM并选择1.9.3-head作为默认的ruby安装: https//rvm.io/rvm/install/

Optional step: You may need XQuartz for some components, for example for Imagemagick, so download & install XQuartz: http://xquartz.macosforge.org/trac/wiki 可选步骤:对于某些组件,您可能需要XQuartz,例如Imagemagick,因此请下载并安装XQuartz: http//xquartz.macosforge.org/trac/wiki

I also had to add this: 我还必须补充一下:

export CC=/usr/bin/gcc-4.2 export CC = / usr / bin / gcc-4.2

in order to make the Apple command line tools work with the rvm. 为了使Apple命令行工具与rvm一起工作。 Without this I had repeated llvm issues: 没有这个,我重复了llvm问题:

The provided CC(gcc) is LLVM based, it is not yet fully supported by ruby and gems, please read rvm requirements . 提供的CC(gcc)是基于LLVM的,它还没有完全支持ruby和gem,请阅读rvm requirements

I had to add 我不得不补充一下

export CPPFLAGS=-I/opt/X11/include

as well as 以及

export CC=/usr/local/bin/gcc-4.2

I was still getting compilation errors due to readline (things like readline.c: In function 'readline_s_vi_editing_mode_p': in the make.log file), and the RVM readline page didn't seem to help, so I ran 由于readline( readline.c: In function 'readline_s_vi_editing_mode_p': make.log文件中),我仍然遇到编译错误,而RVM readline页面似乎没有帮助,所以我跑了

brew install readline

followed by 其次是

rvm install 1.9.3 -C --with-readline-dir=/usr/local/Cellar/readline/6.2.4

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

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