开发者

Building Ruby from source on Mac, not working

I'm trying to build Ruby 1.9.2 from source on Snow Leopard and I keep getting this error:

readline.c: In function ‘username_completion_proc_call’:
readline.c:1292: error: ‘username_completion_function’ undeclared (first use in this function)
readline.c:1292: error: (Each undeclared identifier is reported only once
readline.c:1292: error: for each function it appears in.)
make[1]: *** [readline.o] Error 1
make: *** [mkmain.sh] Error 1

I am basing it off of this tutorial and the error comes when I do the make command.

I already have 1.8.7 installed, but wa开发者_开发问答nt to upgrade to the latest and have not found a reliable, simple way to do it yet.


The easiest way to upgrade to the latest version of Ruby on Snow Leopard is to use RVM (The Ruby Version Manager)


If you haven't upgraded your version of XCode that came on the DVD, then do so from Apple's Developer site. XCode on the DVD has some errors. You have to register, but it's free.

Snow Leopard has 1.8.7 installed, but that is for Apple's use; They install code that actually uses Ruby and messing with their Ruby or installed code could break things. You might not know something broke for a while, until things don't work quite right, so it's better to leave their install alone and put one in for your own use.

As said by other answers, RVM is a great way to install Ruby for your own use. You don't need to install into /usr/local/bin and you definitely don't want to overwrite the Ruby in /usr/bin. RVM deals with this by installing into ~/.rvm. You can have multiple Rubies installed, along with the gems associated with a Ruby, create sets of gems, copy them around, remove or recompile a particular Ruby, or blow it all away without affecting the Apple installed Rubyies. RVM is actively developed and updates often, and the author is very responsive to questions.

RVM has a page dealing with the readline issues. It is specific to dealing with RVM but might help if you want to forego using RVM and go with something else.


I would use rvm its by far the easiest way to get ruby compiled and has many other benefits.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜