Perl/Tk and Mac OS X

Note, there are various sections to this page, one each for Mac OS X 10.4 (Tiger), Mac OS X 10.3 (Panther), Mac OS X 10.2 (Jaguar) and Mac OS X 10.1.2 through 10.1.5 (Puma). Be sure you are reading the Perl/Tk installation notes appropriate for your version of Mac OS X.

For any of this to work, you must have X11 installed. Apple provides (the X11 development environment) for Tiger and Panther on your install CDs or DVD.

Perl/Tk and Mac OS X 10.4 (Tiger)

You can use the Perl 5.8.6 that comes with Tiger or build it yourself. Now fetch the Perl/Tk distribution, (Tk-804.027) . Unpack Perl/Tk and build it using the standard idiom:
tar -zxvpf Tk-804.027.tar.gz
cd Tk-804.027
perl Makefile.PL
make test
sudo make install
Helpful comments from others on my install instructions here.

Perl/Tk and Mac OS X 10.3 (Panther)

Use Perl 5.8.2 and Tk804.025 (beta8 or above). Unpack the Tk distribution first and read README.darwin to learn how to compile Perl for Perl/Tk on Mac OS X.

Perl/Tk and Mac OS X 10.2 (Jaguar)

From: Michael Doster 
Date: Mon Aug 26, 2002  22:30:53 US/Eastern
Subject: Re: Mac "Jaguar" and Perl/Tk, is it safe?

Hello all,

In Mac OS X 10.2, a hacked dyld is no longer necessary to get Perl/Tk to
work.  Here's how:

1) First, upgrade to Mac OS 10.2 (Jaguar). If you do a clean install, pay
close attention to steps 3 and 4.

2) Install the latest development tools from the included Developer Tools

3) If XDarwin doesn't work - and it won't if you did a "clean install"
- them simply reinstall from:

First install                         XInstall_10.1.sit
Then install the fixed xterm

4) If you run OroborOSX and need to re-install, get it here:

5) Fetch perl-5.8.0.tar.gz from CPAN and install thusly:

   tar -zxpf perl-5.8.0.tar.gz
   cd perl-5.8.0
   sh Configure -des
   make test  (97% pass)
   sudo make install

That replaces the default Apple 5.6.0 Perl.

6) Fetch Tk800.024.tar.gz from your favorite CPAN mirror such as this one:

   tar -zxpf Tk800.024.tar.gz
   cd Tk800.024
   perl -v  (ensure 5.8.0 is found)
7) Replace the file Tk/ with this patched copy.
8) While running XDarwin and your favorite terminal app (xterm,rxvt, etc.)
do the usual from the Tk800.024 directory:

   perl Makefile.PL
   make test
   sudo make install

Perl/Tk and Mac OS X 10.1.2 - 10.1.5 (Puma)

The 10.1.2 release of Mac OS X seems to have introduced a compiler optimization bug that causes Perl/Tk to crash with bus errors and segmentation faults. The Perl that comes with Mac OS X, 5.6.0, is compiled with -O3, and that's what Perl/Tk uses, but we want to compile with no optimization. Many thanks to Richard Michaud for the heads-up and helping me track this down. So, here's the recipe for building a working Perl/Tk on Mac OS X:

Perl/Tk and Mac OS X 10.0 (Cheetah)

Sorry, don't recall even trying to build Perl/Tk under Cheetah.

And There You have It!

Have fun, and remember to use Tk;