ruby tk -- how do you get it working?

7

7stud --

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

7stud --

Jeremy said:
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.
 
H

Hidetoshi NAGAI

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

7stud --

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


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)
 
H

Hidetoshi NAGAI

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

7stud --

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


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

7stud --

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


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

Justin Collins

7stud said:
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
 
M

Morton Goldberg

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
 
7

7stud --

Morton said:
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?
 
M

Morton Goldberg

Ok, I found it:

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

7stud --

Morton said:
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:

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

Morton Goldberg

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", "."]
I did this:

$ sudo find / -name *1.8.6* -print

and I got this:

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


This is what I did to install ruby 1.8.6:

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
 
7

7stud --

Morton said:
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", "."]
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 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.
 
M

Morton Goldberg

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.

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
 
7

7stud --

Morton said:
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.
 
M

Morton Goldberg

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
 
J

John Joyce

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?



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.


Thanks for your help. I think I'll just give up on ruby tk.
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.
 
H

Hidetoshi NAGAI

From: 7stud -- <[email protected]>
Subject: Re: ruby tk -- how do you get it working?
Date: Mon, 18 Feb 2008 19:04:31 +0900
Message-ID: said:
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top