Ruby tk -- how do you get it working?

I recently upgraded to ruby 1.8.6 on mac os x 10.4.7. I had ruby tk
working before the upgrade, but now it’s not working. When I run this
program:

require ‘tk’

I get:

`require’: no such file to load – tk (LoadError)

Any tips on what I should do?

On 2008-02-13, 7stud – [email protected] wrote:

`require’: no such file to load – tk (LoadError)

Any tips on what I should do?

First: look for a file called tk.rb or tk.so or tk. on your
system. If you can’t find it, you need to find out why it’s not
there. If you can find it, you need to find out why Ruby can’t.

Regards,

Jeremy H.

Jeremy H. wrote:

On 2008-02-13, 7stud – [email protected] wrote:

`require’: no such file to load – tk (LoadError)

Any tips on what I should do?

First: look for a file called tk.rb or tk.so or tk. on your
system. If you can’t find it, you need to find out why it’s not
there. If you can find it, you need to find out why Ruby can’t.

Uhh, yeah. That’s what I’m doing. Thank you for your interest.

Hidetoshi NAGAI wrote:

From: 7stud – [email protected]
Subject: Re: ruby tk – how do you get it working?
Date: Thu, 14 Feb 2008 10:48:47 +0900
Message-ID: [email protected]

First: look for a file called tk.rb or tk.so or tk. on your
system. If you can’t find it, you need to find out why it’s not
there. If you can find it, you need to find out why Ruby can’t.

Uhh, yeah. That’s what I’m doing. Thank you for your interest.

Please check tke result of “require ‘tcltklib’”.
If fail to do it, you don’t have ‘tcltklib.so’ or
your ‘tcltklib.so’ cannot find available Tcl/Tk libraries.

require ‘tcltklib’

–output:–
`require’: no such file to load – tcltklib (LoadError)

From: 7stud – [email protected]
Subject: Re: ruby tk – how do you get it working?
Date: Thu, 14 Feb 2008 14:02:46 +0900
Message-ID: [email protected]

–output:–
`require’: no such file to load – tcltklib (LoadError)

Well, you have to make or search “tcltklib.so” for your environment.
Sources of “tcltklib.so” are included in Ruby’s source tree.
But, “tcltklib.so” isn’t made, if ext/tk/mkmf.rb can’t find proper
Tcl/Tk libraries at compiling Ruby.

Hidetoshi NAGAI wrote:

From: 7stud – [email protected]
Subject: Re: ruby tk – how do you get it working?
Date: Thu, 14 Feb 2008 14:02:46 +0900
Message-ID: [email protected]

–output:–
`require’: no such file to load – tcltklib (LoadError)

Well, you have to make or search “tcltklib.so” for your environment.
Sources of “tcltklib.so” are included in Ruby’s source tree.
But, “tcltklib.so” isn’t made, if ext/tk/mkmf.rb can’t find proper
Tcl/Tk libraries at compiling Ruby.

I don’t understand what I’m supposed to do. All I know is that Ruby tk
used to work for me, and it was a hassle to setup. Then I upgraded to
ruby 1.8.6., and now Ruby tk doesn’t work. On the other hand, Python tk
worked right out of the box for me.

Should I forget about Ruby tk and just use wxRuby?

Hidetoshi NAGAI wrote:

From: 7stud – [email protected]
Subject: Re: ruby tk – how do you get it working?
Date: Thu, 14 Feb 2008 14:02:46 +0900
Message-ID: [email protected]

–output:–
`require’: no such file to load – tcltklib (LoadError)

Well, you have to make or search “tcltklib.so” for your environment.
Sources of “tcltklib.so” are included in Ruby’s source tree.

I searched my computer and I don’t have any file by that name.

From: 7stud – [email protected]
Subject: Re: ruby tk – how do you get it working?
Date: Thu, 14 Feb 2008 10:48:47 +0900
Message-ID: [email protected]

First: look for a file called tk.rb or tk.so or tk. on your
system. If you can’t find it, you need to find out why it’s not
there. If you can find it, you need to find out why Ruby can’t.

Uhh, yeah. That’s what I’m doing. Thank you for your interest.

Please check tke result of “require ‘tcltklib’”.
If fail to do it, you don’t have ‘tcltklib.so’ or
your ‘tcltklib.so’ cannot find available Tcl/Tk libraries.

7stud – wrote:

worked right out of the box for me.

Should I forget about Ruby tk and just use wxRuby?

Are you building Ruby from source? If so, try going to the ext/tk
directory and running

ruby extconf.rb

If that seems to work, continue with make and make install.
If it does not seem to be finding the Tcl/Tk libraries, try reading the
README.tcltklib file in that directory.

I know I seemed to have a lot of trouble installing the Ruby Tk stuff as
well with the latest Ruby (on Linux, though).

-Justin

Justin C. wrote:

7stud – wrote:

worked right out of the box for me.

Should I forget about Ruby tk and just use wxRuby?

Are you building Ruby from source?

I recently upgraded to Ruby 1.8.6. Ruby tk used to work for me, now it
doesn’t.

On Feb 18, 2008, at 2:52 AM, 7stud – wrote:

Sources of “tcltklib.so” are included in Ruby’s source tree.

I searched my computer and I don’t have any file by that name.

On some platforms (e.g., OS X) it won’t have the ‘.so’ extension. On
my iMac I get

~ mg: sudo find / -name tcltklib.* -print
Password:
/Users/mg/Projects/Ruby/Docs/tcltklib.eng.txt
/usr/lib/ruby/1.8/powerpc-darwin8.0/tcltklib.bundle

If you are running OS X, tcltklib.bundle is what you should look for.

Regards, Morton

On Feb 18, 2008, at 3:05 PM, 7stud – wrote:

my iMac I get

/usr/lib/ruby/1.8/universal-darwin8.0/tcltklib.bundle

Now what do I do?

Ask yourself these questions: Is /usr/lib/ruby/1.8 where Ruby 1.8.6
is installed? Or is 1.8.6 in some other directory? If it’s in some
other directory, why didn’t two versions of tcltklib.bundle turn up
from find?

I’m thinking that your 1.8.6 installation is incomplete – that it’s
possible you didn’t install tcltklib.bundle when you installed 1.8.6.

Regards, Morton

Morton G. wrote:

On Feb 18, 2008, at 2:52 AM, 7stud – wrote:

Sources of “tcltklib.so” are included in Ruby’s source tree.

I searched my computer and I don’t have any file by that name.

On some platforms (e.g., OS X) it won’t have the ‘.so’ extension. On
my iMac I get

~ mg: sudo find / -name tcltklib.* -print
Password:
/Users/mg/Projects/Ruby/Docs/tcltklib.eng.txt
/usr/lib/ruby/1.8/powerpc-darwin8.0/tcltklib.bundle

If you are running OS X, tcltklib.bundle is what you should look for.

Ok, I found it:

/usr/lib/ruby/1.8/universal-darwin8.0/tcltklib.bundle

Now what do I do?

On Feb 18, 2008, at 10:28 PM, 7stud – wrote:

is installed?

How would I know that?

Here is one way to do it:

~ mg: irb
irb(main):001:0> RUBY_VERSION
=> “1.8.2”
irb(main):002:0> $:
=> ["/usr/lib/ruby/site_ruby/1.8", “/usr/lib/ruby/site_ruby/1.8/
powerpc-darwin8.0”, “/usr/lib/ruby/site_ruby”, “/usr/lib/ruby/1.8”, “/
usr/lib/ruby/1.8/powerpc-darwin8.0”, “.”]

If it’s in some
other directory, why didn’t two versions of tcltklib.bundle turn up
from find?

I’m thinking that your 1.8.6 installation is incomplete – that it’s
possible you didn’t install tcltklib.bundle when you installed 1.8.6.

This is what I did to install ruby 1.8.6:

This package’s intention is to remain small while being a Universal
Binary that serves everything to deploy Ruby Applications on OSX
Machines - Cheetah, Puma, Jaguar, Panther, Tiger or Leopard. You don’t
need to compile anything and you don’t need Apple’s Developer Tools
(xcode) installed.

The Ruby O.-Click Installer for OSX is adding the installed files to
/usr/local, not replacing Apple’s original Ruby. That means you can
easily uninstall this package or switch to Apple’s Ruby again.

It looks to me as if your 1.8.6 install didn’t include the Ruby/Tk
libraries, which would explain why Ruby/Tk doesn’t work when you run
1.8.6, and as if the installer you used is aimed at supporting Rails
rather than being a full-bore Ruby install.

Regards, Morton

Morton G. wrote:

On Feb 18, 2008, at 10:28 PM, 7stud – wrote:

is installed?

How would I know that?

Here is one way to do it:

~ mg: irb
irb(main):001:0> RUBY_VERSION
=> “1.8.2”
irb(main):002:0> $:
=> ["/usr/lib/ruby/site_ruby/1.8", “/usr/lib/ruby/site_ruby/1.8/
powerpc-darwin8.0”, “/usr/lib/ruby/site_ruby”, “/usr/lib/ruby/1.8”, “/
usr/lib/ruby/1.8/powerpc-darwin8.0”, “.”]

If it’s in some
other directory, why didn’t two versions of tcltklib.bundle turn up
from find?

I’m thinking that your 1.8.6 installation is incomplete – that it’s
possible you didn’t install tcltklib.bundle when you installed 1.8.6.

This is what I did to install ruby 1.8.6:

This package’s intention is to remain small while being a Universal
Binary that serves everything to deploy Ruby Applications on OSX
Machines - Cheetah, Puma, Jaguar, Panther, Tiger or Leopard. You don’t
need to compile anything and you don’t need Apple’s Developer Tools
(xcode) installed.

The Ruby O.-Click Installer for OSX is adding the installed files to
/usr/local, not replacing Apple’s original Ruby. That means you can
easily uninstall this package or switch to Apple’s Ruby again.

It looks to me as if your 1.8.6 install didn’t include the Ruby/Tk
libraries, which would explain why Ruby/Tk doesn’t work when you run
1.8.6, and as if the installer you used is aimed at supporting Rails
rather than being a full-bore Ruby install.

Regards, Morton

Ok. I would like to uninstall whatever I installed. The one click
installer website says:

The Ruby O.-Click Installer for OSX is adding the installed files to
/usr/local, not replacing Apple’s original Ruby. That means you can
easily uninstall this package or switch to Apple’s Ruby again.

When I do this:

/usr/local$ ls

I get:

bin man
include mysql
info mysql-5.0.41-osx10.4-i686
lib

Do you have any idea what I should do to uninstall ruby 1.8.6? I really
think the main ruby website should remove the link to the one click
installer.

Morton G. wrote:

On Feb 18, 2008, at 3:05 PM, 7stud – wrote:

my iMac I get

/usr/lib/ruby/1.8/universal-darwin8.0/tcltklib.bundle

Now what do I do?

Ask yourself these questions: Is /usr/lib/ruby/1.8 where Ruby 1.8.6
is installed?

How would I know that? Here’s what’s in /usr/lib/ruby/1.8:

English.rb md5.rb sync.rb
Env.rb mkmf.rb tcltk.rb
abbrev.rb monitor.rb tempfile.rb
base64.rb multi-tk.rb test
benchmark.rb mutex_m.rb thread.rb
bigdecimal net thwait.rb
cgi observer.rb time.rb
cgi-lib.rb open-uri.rb timeout.rb
cgi.rb open3.rb tk
complex.rb openssl tk.rb
csv.rb openssl.rb tkafter.rb
date optparse tkbgerror.rb
date.rb optparse.rb tkcanvas.rb
date2.rb ostruct.rb tkclass.rb
debug.rb parsearg.rb tkconsole.rb
delegate.rb parsedate.rb tkdialog.rb
dl pathname.rb tkentry.rb
drb ping.rb tkextlib
drb.rb pp.rb tkfont.rb
e2mmap.rb prettyprint.rb tkmacpkg.rb
erb.rb profile.rb tkmenubar.rb
eregex.rb profiler.rb tkmngfocus.rb
expect.rb pstore.rb tkpalette.rb
fileutils.rb racc tkscrollbox.rb
finalize.rb rational.rb tktext.rb
find.rb rdoc tkvirtevent.rb
forwardable.rb readbytes.rb tkwinpkg.rb
ftools.rb remote-tk.rb tmpdir.rb
generator.rb resolv-replace.rb tracer.rb
getoptlong.rb resolv.rb tsort.rb
getopts.rb rexml un.rb
gserver.rb rinda universal-darwin8.0
importenv.rb rss uri
io rubyunit.rb uri.rb
ipaddr.rb runit weakref.rb
irb scanf.rb webrick
irb.rb set.rb webrick.rb
jcode.rb sha1.rb wsdl
kconv.rb shell xmlrpc
logger.rb shell.rb xsd
mailread.rb shellwords.rb yaml
mathn.rb singleton.rb yaml.rb
matrix.rb soap

Or is 1.8.6 in some other directory?

I did this:

$ sudo find / -name 1.8.6 -print

and I got this:

/usr/local/lib/libruby.1.8.6.dylib

If it’s in some
other directory, why didn’t two versions of tcltklib.bundle turn up
from find?

I’m thinking that your 1.8.6 installation is incomplete – that it’s
possible you didn’t install tcltklib.bundle when you installed 1.8.6.

This is what I did to install ruby 1.8.6:

  1. I downloaded the one click installer for MAC OSX here:

http://www.ruby-lang.org/en/downloads/

  1. That put rubyosx-tiger-1.2.pkg.zip on my desktop.

  2. I clicked on that file, and it uzipped itself and put the following
    on my desktop:

Ruby O.-Click Installer for OSX Tiger.pkg

  1. I clicked on that, and then it asked me what volume to install on. I
    only have one volume: Macintosh HD.

At the one click installer website it says this:


This package is the most simple way to equip your Macintosh Apple OSX
System with Ruby - similar to the Windows Ruby O.-Click Installer. It
replaces the broken Readline library, updates to a current version of
SQLite3 and prepares your OSX for Rails, which needs at least Ruby 1.8.4
to run. The current Ruby Version is 1.8.6 (1.8.5 is recommended for
Rails) and Rubygems 0.9.4.

This package’s intention is to remain small while being a Universal
Binary that serves everything to deploy Ruby Applications on OSX
Machines - Cheetah, Puma, Jaguar, Panther, Tiger or Leopard. You don’t
need to compile anything and you don’t need Apple’s Developer Tools
(xcode) installed.

The Ruby O.-Click Installer for OSX is adding the installed files to
/usr/local, not replacing Apple’s original Ruby. That means you can
easily uninstall this package or switch to Apple’s Ruby again.

On Feb 19, 2008, at 7:05 AM, 7stud – wrote:

installer.
Well, if you made a full backup of your start-up drive before you
installed 1.8.6 (and you should have), you can just restore /usr/
local/ from your backup. That’s what I would do. If you don’t have a
recent backup, then I can’t help you because I have no idea what the
installer you used installed. Perhaps someone else who has installed
1.8.6 from the same installer that you used can help and will post.

But maybe you are giving up to easily; maybe you shouldn’t uninstall.
you might try finding and adding the missing Ruby/Tk library files. I
should think they would be available for download from svn.ruby-
lang.org.

Regards, Morton

Morton G. wrote:

On Feb 19, 2008, at 7:05 AM, 7stud – wrote:

installer.
Well, if you made a full backup of your start-up drive before you
installed 1.8.6 (and you should have),

You mean my Macintosh HD? I didn’t back it up. Are you supposed to
back up a 250G drive every time you install something?

If you don’t have a
recent backup, then I can’t help you because I have no idea what the
installer you used installed.

The one click installer instructions make it sound like you could just
delete a directory and it would be gone. Now I really think that link
should be removed from the main ruby website. There’s no contact info
for the one click installer, so there is no one I can contact about
uninstalling it.

But maybe you are giving up to easily; maybe you shouldn’t uninstall.
you might try finding and adding the missing Ruby/Tk library files. I
should think they would be available for download from svn.ruby-
lang.org.

Thanks for your help. I think I’ll just give up on ruby tk.

On Feb 19, 2008, at 9:01 AM, 7stud – wrote:

The one click installer is fine. It is stripped down a bit, but
everything is in standard locations in /usr/local/
This includes /usr/local/bin and /usr/local/lib/
Basically, it’s very similar to the Hivelogic installation. You can
either, install over it (use the Hivelogic tutorial, please) OR
simply rm -rf the directories for what got installed.
It uses an OS X installer, so it should have an item in ~/Library/
Receipts/ OR in /Library/Receipts
launching that item will relaunch the installer. It will allow you to
get a manifest of installation items and some installers have an
uninstaller.

On Feb 19, 2008, at 10:01 AM, 7stud – wrote:

You mean my Macintosh HD? I didn’t back it up. Are you supposed to
back up a 250G drive every time you install something?

Yes. At least when you are installing a large package like Ruby
1.8.6. There are products (I use SuperDuper) that make this both
quick and easy (because they only update the backup image rather than
making a whole new one).

If you have a recent update, you can compare /usr/local/ on your
start-up drive to /usr/local/ on your backup drive to see what changed.

Regards, Morton