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?

···

--
Posted via http://www.ruby-forum.com/.

First: look for a file called tk.rb or tk.so or tk.<something> 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 Henty

···

On 2008-02-13, 7stud -- <bbxx789_05ss@yahoo.com> wrote:

`require': no such file to load -- tk (LoadError)

Any tips on what I should do?

Jeremy Henty wrote:

···

On 2008-02-13, 7stud -- <bbxx789_05ss@yahoo.com> 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.<something> 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.
--
Posted via http://www.ruby-forum.com/\.

Message-ID: <4eb078c86da334ca3f871d8b1109c339@ruby-forum.com>

> First: look for a file called tk.rb or tk.so or tk.<something> 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.

···

From: 7stud -- <bbxx789_05ss@yahoo.com>
Subject: Re: ruby tk -- how do you get it working?
Date: Thu, 14 Feb 2008 10:48:47 +0900
--
Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)

Hidetoshi NAGAI wrote:

From: 7stud -- <bbxx789_05ss@yahoo.com>
Subject: Re: ruby tk -- how do you get it working?
Date: Thu, 14 Feb 2008 10:48:47 +0900
Message-ID: <4eb078c86da334ca3f871d8b1109c339@ruby-forum.com>

> First: look for a file called tk.rb or tk.so or tk.<something> 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)

···

--
Posted via http://www.ruby-forum.com/\.

Message-ID: <5ff4baf0037188ad2e549d7a9a281b6e@ruby-forum.com>

--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.

···

From: 7stud -- <bbxx789_05ss@yahoo.com>
Subject: Re: ruby tk -- how do you get it working?
Date: Thu, 14 Feb 2008 14:02:46 +0900
--
Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)

Hidetoshi NAGAI wrote:

From: 7stud -- <bbxx789_05ss@yahoo.com>
Subject: Re: ruby tk -- how do you get it working?
Date: Thu, 14 Feb 2008 14:02:46 +0900
Message-ID: <5ff4baf0037188ad2e549d7a9a281b6e@ruby-forum.com>

--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?

···

--
Posted via http://www.ruby-forum.com/\.

Hidetoshi NAGAI wrote:

From: 7stud -- <bbxx789_05ss@yahoo.com>
Subject: Re: ruby tk -- how do you get it working?
Date: Thu, 14 Feb 2008 14:02:46 +0900
Message-ID: <5ff4baf0037188ad2e549d7a9a281b6e@ruby-forum.com>

--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.

···

--
Posted via http://www.ruby-forum.com/\.

7stud -- wrote:

Hidetoshi NAGAI wrote:
  

From: 7stud -- <bbxx789_05ss@yahoo.com>
Subject: Re: ruby tk -- how do you get it working?
Date: Thu, 14 Feb 2008 14:02:46 +0900
Message-ID: <5ff4baf0037188ad2e549d7a9a281b6e@ruby-forum.com>
    

--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?
  
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

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 2:52 AM, 7stud -- wrote:

Hidetoshi NAGAI wrote:

From: 7stud -- <bbxx789_05ss@yahoo.com>
Subject: Re: ruby tk -- how do you get it working?
Date: Thu, 14 Feb 2008 14:02:46 +0900
Message-ID: <5ff4baf0037188ad2e549d7a9a281b6e@ruby-forum.com>

--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.

Justin Collins 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.

···

--
Posted via http://www.ruby-forum.com/\.

Morton Goldberg 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?
--
Posted via http://www.ruby-forum.com/\.

mmm, that thread is soo long... and doesn't seem to solve the firs
issue... does it?
anyway...

For me, it started to work when I did the following:

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.

it gave me an error message saying to recompile with --enable-pthread
option. which I did... solved my ruby tk trouble.

so, what you need to de is :

   * get ruby source
   * ./configure --enable-pthread
   * make
   * make test
   * sudo make install

···

--
Posted via http://www.ruby-forum.com/\.

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

···

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

Morton Goldberg 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?

Message-ID: <c77508e16052572bfc404f0138cec4ed@ruby-forum.com>

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

How did you upgrade your Ruby?
I found Japanese document of "installation with MacPorts".
On the document, "+mactk" variant is used.
Although I don't understand package system of MacOS X,
checking variants of current ruby ports may help you.

# Please don't ask me about the result of checking,
# Probably, I can answer none of your questions.

···

From: 7stud -- <bbxx789_05ss@yahoo.com>
Subject: Re: ruby tk -- how do you get it working?
Date: Mon, 18 Feb 2008 19:04:31 +0900
--
                                       永井 秀利 (九工大 知能情報)
                                           nagai@ai.kyutech.ac.jp

Morton Goldberg 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/

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

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

Ruby One-Click Installer for OSX Tiger.pkg

4) 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:

···

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

----
This package is the most simple way to equip your Macintosh Apple OSX
System with Ruby - similar to the Windows Ruby One-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 One-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.
----
--
Posted via http://www.ruby-forum.com/\.

Hidetoshi NAGAI wrote:

From: 7stud -- <bbxx789_05ss@yahoo.com>
Subject: Re: ruby tk -- how do you get it working?
Date: Mon, 18 Feb 2008 19:04:31 +0900
Message-ID: <c77508e16052572bfc404f0138cec4ed@ruby-forum.com>

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

How did you upgrade your Ruby?

I think I laid it out pretty clearly in my posts.

···

--
Posted via http://www.ruby-forum.com/\.

Morton Goldberg 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?

<snip>

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", "."]

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:

<snip>

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 One-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 One-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

···

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

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

Morton Goldberg wrote:

is installed?

How would I know that?

<snip>

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:

<snip>

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 One-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 One-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.

···

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

--
Posted via http://www.ruby-forum.com/\.

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

···

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

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

The Ruby One-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.