# Ruby Tk on Tiger

**URL:** <https://www.ruby-forum.com/t/ruby-tk-on-tiger/68914>\
**Category:** Ruby\
**Created:** [September 16, 2006, 7:44pm UTC](https://www.ruby-forum.com/t/ruby-tk-on-tiger/68914 "2006-09-16T19:44:53Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![farfignugen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/f17d59/32.png) [@farfignugen](https://www.ruby-forum.com/u/farfignugen)\
**Post date:** [September 16, 2006, 7:44pm UTC](https://www.ruby-forum.com/t/ruby-tk-on-tiger/68914/1 "2006-09-16T19:44:53Z")

</div>

I’m running ruby 1.8.5 (2006-09-10) [powerpc-darwin8.7.0] and when I  
try they little simple Tk application on the first page of the Ruby  
Tk chapter of the Pickaxe Book I get:  
~ $ ruby -w TK.rb  
./tk.rb:7: uninitialized constant TkRoot (NameError)  
from TK.rb:6:in `require’  
from TK.rb:6

However if I run the pre-installed ruby that came with Tiger like:  
~ $ /usr/bin/ruby -w TK.rb

I get a nice little window with “Hello World!” in it as well as ruby,  
File and Edit menus. The archives seem to have quite a bit of  
discussion of this issue but I couldn’t find any resolution. Did  
anyone figure out how Apple got Tk working?

---

<div class="post-metadata">

**Author:** ![farfignugen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/f17d59/32.png) [@farfignugen](https://www.ruby-forum.com/u/farfignugen)\
**Post date:** [September 17, 2006, 3:33pm UTC](https://www.ruby-forum.com/t/ruby-tk-on-tiger/68914/2 "2006-09-17T15:33:53Z")

</div>

On Sep 16, 2006, at 1:43 PM, Chris G. wrote:

> I get a nice little window with “Hello World!” in it as well as  
> ruby, File and Edit menus. The archives seem to have quite a bit of  
> discussion of this issue but I couldn’t find any resolution. Did  
> anyone figure out how Apple got Tk working?

I suggest you check $: for where your Ruby is looking for libraries  
and then verify whether or not tk.rb is available in one of those  
libraries. I think it’s likely that it’s not.

Ruby 1.8.2 finds tk.rb in /usr/lib/ruby/1.8. but I don’t know if this  
version will work with 1.8.5.

Regards, Morton

---

<div class="post-metadata">

**Author:** ![farfignugen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/f17d59/32.png) [@farfignugen](https://www.ruby-forum.com/u/farfignugen)\
**Post date:** [September 17, 2006, 6:50pm UTC](https://www.ruby-forum.com/t/ruby-tk-on-tiger/68914/3 "2006-09-17T18:50:07Z")

</div>

On Sep 17, 2006, at 6:32 AM, Morton G. wrote:

> > However if I run the pre-installed ruby that came with Tiger like:
> 
> Ruby 1.8.2 finds tk.rb in /usr/lib/ruby/1.8. but I don’t know if  
> this version will work with 1.8.5.
> 
> Regards, Morton

Good catch, Morton. tk.rb is nowhere to be found in any of my  
$LOAD\_PATH files. I still don’t understand why I get the  
‘uninitialized constant’ message rather than ‘no such file to load’  
but the problem is that there really isn’t any such file to load.

---

<div class="post-metadata">

**Author:** ![farfignugen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/f17d59/32.png) [@farfignugen](https://www.ruby-forum.com/u/farfignugen)\
**Post date:** [September 17, 2006, 7:34pm UTC](https://www.ruby-forum.com/t/ruby-tk-on-tiger/68914/4 "2006-09-17T19:34:12Z")

</div>

On Sep 17, 2006, at 9:49 AM, Chris G. wrote:

> > > ```
> > > from TK.rb:6:in `require'
> > > 
> > > ```
> > 
> > I suggest you check $: for where your Ruby is looking for  
> > ‘uninitialized constant’ message rather than ‘no such file to load’  
> > but the problem is that there really isn’t any such file to load.

OK, I thought I might be able to fix the problem by modifying my test  
program as follows:  
$: \<\< ‘/usr/lib/ruby/1.8/powerpc-darwin8.0’  
require ‘/usr/lib/ruby/1.8/tk’  
root = TkRoot.new {title “Ex1”}  
TkLabel.new(root) do  
text ‘Hello World!’  
pack {padx 15 ; pady 15; side ‘left’}  
end

But now I get:  
~ $ ruby -w TK.rb  
dyld: NSLinkModule() error  
dyld: Symbol not found: \_is\_ruby\_native\_thread  
Referenced from: /usr/lib/ruby/1.8/powerpc-darwin8.0/tcltklib.bundle  
Expected in: flat namespace

Trace/BPT trap

All I can figure out from this is that the old version of tk.rb is  
loading a dynamic library and the dynamic loader can’t resolve a  
symbol. I’d appreciate any pointer but I suspect that this is best  
pursued on one of the Apple mailing lists.

–  
For blocks are better cleft with wedges,  
Than tools of sharp or subtle edges,  
And dullest nonsense has been found  
By some to be the most profound.  
-Samuel Butler,
