Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Ok, this is what I did before I landed onto a terminal with a bunch of error messages...

First, I installed ruby1.9.1 using apt-get. (All of those ruby1.9.1 packages including ruby1.9.1-examples and ruby1.9.1-full).

Then, I installed tcl8.5 and tk8.5 including their dev packages similarly.

Then, I installed libtcltk-ruby1.9.1

As expected, ruby --version says that I have got

ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-linux]

But in irb, when I require 'tk' it says:

RuntimeError: tcltklib: fail to Tk_Init(). Can't find a usable tk.tcl in the following directories: 
/usr/share/tcltk/tcl8.5/tk8.5 /usr/lib/tk8.5 /usr/local/lib/tcltk/tk8.5 /usr/local/share/tcltk/tk8.5 /usr/lib/tcltk/tk8.5 /usr/share/tcltk/tk8.5 /lib/tk8.5 /usr/library

/usr/share/tcltk/tk8.5/tk.tcl: version conflict for package "Tk": have 8.5.10, need     exactly 8.5.11
version conflict for package "Tk": have 8.5.10, need exactly 8.5.11
while executing
"package require -exact Tk  8.5.11"
(file "/usr/share/tcltk/tk8.5/tk.tcl" line 18)
invoked from within
"source /usr/share/tcltk/tk8.5/tk.tcl"
("uplevel" body line 1)
invoked from within
"uplevel #0 [list source $file]"

This probably means that tk wasn't installed properly.

from /usr/lib/ruby/1.9.1/tk.rb:31:in `initialize'
from /usr/lib/ruby/1.9.1/tk.rb:31:in `initialize'
from /usr/lib/ruby/1.9.1/tk.rb:1245:in `new'
from /usr/lib/ruby/1.9.1/tk.rb:1245:in `block in <module:TkCore>'

Similar procedure worked when I used ruby1.8 and same version of tcl and tk, but this doesn't seem to work. I think it has something to do with these packages and their dependencies.

So, finally my question is: How to install tk and ruby, if I want to program Tk GUI in ruby1.9?

share|improve this question
up vote 1 down vote accepted

open this file in your test editer as root "/usr/share/tcltk/tk8.5/tk.tcl" go to line18 change this: package require -exact Tk 8.5.11 To to this: package require -exact Tk 8.5.10

share|improve this answer
Thumbs up for tk.tcl file! Seems like 8.5.11 has still got some bugs to be solved... Anyway, thanks!! – Forbidden Overseer Jun 16 '12 at 20:00

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.