These notes are an attempt to bring together enough information
to enable a typical Mac OS X developer to install and use Perl/Tk.
Executive summary: Perl/Tk can be used now with X11;
a version which runs directly on Cocoa will be available RSN.
Perl/Tk with X11
This section is based, in large part, on the information given in
If you have not already done so, upgrade to Mac OS 10.2 (Jaguar).
Be certain to:
Install the latest development tools
from the included Developer Tools CD.
Install the latest updates to the Developer Tools.
Install Apple's X11 beta (or XDarwin) from
Be certain to install the X11 SDK package
(same page, link in lower right).
Upgrade to Perl 5.8
(!!! optional for Tk800.024; required for Tk804.24 !!!)
Fetch perl-5.8.0.tar.gz from CPAN and install it:
% 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.
Fetch the Tk archive from your favorite CPAN mirror;
you can download this "manually" from
.../Tk804.0_24.tar.gz, as appropriate).
or by using the CPAN Shell:
% perl -MCPAN -e shell
cpan> get Tk
Don't run "perl -MCPAN -e 'install Tk'";
you will need to modify one file before building Tk.
Ignore any recommendations to
"install Net::FTP as soon as possible",
unless you have (or want to install) Perl 5.8.0.
Run (and read :-) "perldoc CPAN"
if you have never used the CPAN shell before.
Note that there are two "current" versions of Perl/Tk:
The CPAN shell downloads and installs Tk800_24 (17 Mar 2002).
This one will build with Perl 5.6.0.
There is another Perl/Tk release, Tk804.024 (13 Oct 2002)
that is available from the CPAN;
if you don't use the CPAN shell, you may get this one.
(Note: Tk804.024 claims to require Perl 5.7 or above.)
On Mac OS X, you will need to modify ".../Tk/MMutil.pm".
If you used the CPAN shell to retrieve the Perl/Tk archive,
this file will be in "~/.cpan/build/Tk800.024/Tk".
Otherwise, it will be wherever your download put it (:-).
A patched version of MMutil.pm is available at
If you copy/paste the contents,
take care that you don't break lines
(some lines exceed 80 characters).
The actual difference is the addition of
one new block of code.
Now build the package:
% perl Makefile.PL
If you get an error of the form:
Makefile:2088: *** missing separator. Stop.
make: *** [pTk/libpTk.a] Error 2
check the file "pTk/Makefile".
If one of the lines in "MMutil.pm" was broken,
it can result in the following line:
config :: $(C_FILES) $(H_FILES)
being broken onto a second line in "pTk/Makefile".
Next, run the tests.
From inside X11, using your favorite X terminal app
(xterm is the default), run the test suite:
% make test
All tests successful.
Files=25, Tests=904, 53 wallclock secs
(21.42 cusr + 3.77 csys = 25.19 CPU)
You cannot run the Perl/Tk tests from Terminal;
they must be run from within an X11 session.
Lastly, install the Tk package.
% sudo make install
That's it; you're done. Now you can work with Perl/Tk.
Perl/Tk with Cocoa
There is a version of Tcl/Tk (TclTkAqua) that runs directly on Cocoa.
X11 is not required and Cocoa (rather than X11) widgets are used.
BUT, there is no version of Perl/Tk (yet :-)
that works with TclTkAqua.
Jim Ingham (the TclTkAqua developer) says:
Last time I heard, folks were working on a version of PerlTk
that would use Tk 8.4.x, but very slowly, as it seemed.
The first AquaTk port was 8.4.0, so this is the first requirement.
After that, somebody is going to have to do whatever magic they do
to the Tk sources to munge them into PerlTk sources
for the AquaTk port sources as well as the Windows & Unix ones.
I have had a few preliminary pings about this,
but not in the past 6 months or so.
The Perl/Tk versions I've seen for OSX are called "Tk800.024" and
Tk800.024 is based on "Tk 8.0.5".
It is listed as the "latest release" on the CPAN.
It installs and works OK with Perl 5.6.0 (as shipped by Apple).
Tk804.0_24 is based on Tk 8.4a2.
It is listed as a "developer release" on the CPAN.
It requires Perl 5.8.0, so I haven't tried it.
So, it sounds like a couple of issues need to be resolved.
First, there needs to be a production release of Perl/Tk,
based on Tk 8.4.x.
Then, there would have to be a variant of this
which took AquaTkTcl's changes into account.
I have no way of knowing, but my guess is that this isn't imminent.
However, I received a promising note from Steve Lidie:
... when Perl/Tk based on Tk 8.4.+ is available,
I'll look at the Aqua mods.
In the meantime,
X11 Perl/Tk with quartz-wm (or OroborOSX) look decent.