RVM Ruby with TK installation (OSX)

人盡茶涼 提交于 2019-12-18 07:09:08

问题


I'm trying to install Ruby with TK support.

Using RVM, I did this:

rvm install 1.9.2 -C --enable-shared --enable-pthread

The installation appears to work fine, and I can see something called

.rvm/src/ruby-1.9.2-p320/ext/tk/tcltklib.c

which I assume is the library I need?

I then try to run

require 'tk'

in irb, but get the error message

LoadError: no such file to load -- tk

Any ideas?

Update: Fixed!

If anyone is interested in the complete list of steps for a Ruby upgrade to 2.0.0 with TK support on OSX, this is what I did:

Install RVM for Ruby -

\curl -#L https://get.rvm.io | bash -s stable --autolibs=3 --ruby

Install TK from ActiveTcl - http://www.activestate.com/activetcl

Run

rvm reinstall 2.0.0 --enable-shared --enable-pthread --with-tk --with-tcl

Fire up irb and check the TK installation was successful with

require 'tk'

回答1:


RVM disables tk/tcl by default (problems on OS X), you need to tell ruby (via rvm) you want tk/tcl:

rvm install 1.9.2 --enable-shared --enable-pthread --with-tk --with-tcl



回答2:


First, install ActiveState's ActiveTCL from here. Then, reinstall Ruby with this command:

rvm reinstall 1.9.2 --enable-pthread


来源:https://stackoverflow.com/questions/16113143/rvm-ruby-with-tk-installation-osx

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!