# Tk on Snow Leopard

**URL:** <https://www.ruby-forum.com/t/tk-on-snow-leopard/177094>\
**Category:** Ruby\
**Created:** [October 11, 2009, 3:34pm UTC](https://www.ruby-forum.com/t/tk-on-snow-leopard/177094 "2009-10-11T15:34:16Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dudebot](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/e495f1/32.png) [@Dudebot](https://www.ruby-forum.com/u/Dudebot)\
**Post date:** [October 11, 2009, 3:34pm UTC](https://www.ruby-forum.com/t/tk-on-snow-leopard/177094/1 "2009-10-11T15:34:16Z")

</div>

Sorry about posting an OS specific question here, but the Apple  
support discussion groups seem to think this is a problem with Tk  
bindings in Ruby, not with Snow Leopard. Makes no sense to me, but  
whatever.

I’ve used Tk as my go-to GUI for Ruby for years, and love it. In  
Leopard (10.5) Tk bindings worked, in Snow Leopard (10.6) I get this  
error if I try to run a script with “require tk”

LoadError: no such file to load — tk

Does anyone know a good workaround? Has anyone had success getting tk  
bindings to work in 10.6, e.g. with MacPorts? I haven’t tried that  
approach–I wanted to find out others experience before I went through  
that.

Frankly, I wish that I could replace MacOS with Linux on this hardware  
(I mean replace, not run a vm) but I digress.

TIA,  
Craig

---

<div class="post-metadata">

**Author:** ![Dudebot](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/e495f1/32.png) [@Dudebot](https://www.ruby-forum.com/u/Dudebot)\
**Post date:** [October 12, 2009, 12:25am UTC](https://www.ruby-forum.com/t/tk-on-snow-leopard/177094/2 "2009-10-12T00:25:24Z")

</div>

On Oct 11, 2009, at 06:29 , Dudebot wrote:

> Does anyone know a good workaround? Has anyone had success getting tk  
> bindings to work in 10.6, e.g. with MacPorts? I haven’t tried that  
> approach–I wanted to find out others experience before I went through  
> that.

Sure enough, it looks like apple didn’t ship the tk extension:

511 % find /System/Library/Frameworks/Ruby.framework/Versions/Current -  
name tk.rb  
512 %

The obvious workaround is to build and install your own ruby (either  
yourself or via macports). That requires having the developer tools  
installed so you have a C compiler. By default ruby will install into /  
usr/local/ (/opt/local if macports) and that won’t be in your path.  
You’ll need to either add it BEFORE /usr/bin so the stock ruby gets  
overridden or rename the stock ruby.

---

<div class="post-metadata">

**Author:** ![Dudebot](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/e495f1/32.png) [@Dudebot](https://www.ruby-forum.com/u/Dudebot)\
**Post date:** [October 12, 2009, 11:35am UTC](https://www.ruby-forum.com/t/tk-on-snow-leopard/177094/3 "2009-10-12T11:35:40Z")

</div>

…

> Sure enough, it looks like apple didn’t ship the tk extension:  
> …  
> The obvious workaround is to build and install your own ruby  
> …

Thanks super, Ryan. I was hoping to try to avoid that, but… 🙂  
For those who are interested, the best instructions I found for  
installing Ruby-Tk on Snow Leopard were at Dan Benjamin’s Hivelogic  
site:

> **[Dan Benjamin](https://danbenjamin.com)**
>
> Dan Benjamin's personal website.

A virtual thank you to Dan 🙂

Craig
