在 Mac OS X 10.8.2 上安装 Ruby [英] Installing Ruby on Mac OS X 10.8.2

查看:21
本文介绍了在 Mac OS X 10.8.2 上安装 Ruby的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我提到了安装 Ruby on Rails - Mac OS Lion 并按照 Alain Beauvois 的回复 得到了很多一切都起来.唯一的区别是我使用的是 1.9.3 而不是 1.9.2.

I have referred to Installing Ruby on Rails - Mac OS Lion and followed Alain Beauvois's reply and got pretty much everything up. The only difference is I am using 1.9.3 instead of 1.9.2.

我已经创建了 .bash_profile,甚至通过 open -e .bash_profile 确保它存在,甚至添加了 Alain Beauvois 所述的行.

I have created .bash_profile and even made sure that is there by open -e .bash_profile and even added the line as stated by Alain Beauvois.

但现在问题似乎是我收到此错误:

But what seems to be the problem now is I am getting this error:

Error running 'make', please read /usr/local/rvm/log/ruby-1.9.3-p374/make.log
There has been an error while running make. Halting the installation.

引用的日志包含以下内容:

The referenced log contains this:

[2013-02-02 21:41:52] make
    CC = clang
    LD = ld
    LDSHARED = clang -dynamic -bundle
    CFLAGS = -O3 -ggdb -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Werror=pointer-arith -Werror=write-strings -Werror=declaration-after-statement -Werror=shorten-64-to-32 -Werror=implicit-function-declaration  -pipe 
    XCFLAGS = -include ruby/config.h -include ruby/missing.h -fvisibility=hidden -DRUBY_EXPORT
    CPPFLAGS = -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE   -I/usr/local/rvm/usr/include -I. -I.ext/include/x86_64-darwin12.2.1 -I./include -I.
    DLDFLAGS = -Wl,-undefined,dynamic_lookup -Wl,-multiply_defined,suppress -Wl,-flat_namespace  
    SOLIBS = 
compiling regparse.c
regparse.c:582:15: error: implicit conversion loses integer precision: 'st_index_t' (aka 'unsigned long') to 'int' [-Werror,-Wshorten-64-to-32]
    return t->num_entries;
    ~~~~~~ ~~~^~~~~~~~~~~
1 error generated.
make: *** [regparse.o] Error 1

我什至尝试过

rvm -install ruby-1.9.3-p374

但仍然得到同样的错误.在我进入这部分之前,我确实遇到了一些奇怪的错误,但是在我重新运行它并在它前面添加 sudo 之后,它起作用了.AFAIK,sudo = 使用 su 权限/特权做某事,对吗?

but still get the same error. I did get some weird errors before I got to this part but after I reran it with an addition of sudo in front of it, it worked. AFAIK, sudo = doing something with su permissions/privileges, right?

推荐答案

刚刚找到 this.我认为这是你需要做的.

Just found this. I think this is what you need to do.

首先,如果您还没有下载 MacPorts 并安装它.然后运行以下两条命令:

First, if you haven't already, download MacPorts and install it. Then run the following two commands:

sudo port selfupdate
sudo port install apple-gcc42

太获取真正的 UNIX GCC.然后,安装 1.9.3 运行:

Too get real UNIX GCC. Then, to install 1.9.3 run:

CC=/opt/local/bin/gcc-apple-4.2 rvm install ruby-1.9.3-p194 --enable-shared --without-tk --without-tcl

它告诉 rvm 使用 UNIX GCC 安装 Ruby,没有需要 X11 的 Tk 或 Tcl(OSX 10.8 除外).如果您需要 readline 支持、OpenSSL 等,请查看上面链接的要点.

Which tells rvm to install Ruby using UNIX GCC without Tk or Tcl which require X11 (left out of OSX 10.8). If you want things like readline support, OpenSSL, etc., check out the above linked gist.

这篇关于在 Mac OS X 10.8.2 上安装 Ruby的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆