Mac Forums

Mac Forums (
-   OS X - Development and Darwin (
-   -   Installing Tk on OSX (

jsw2013 06-25-2013 12:33 PM

Installing Tk on OSX
I am having trouble installing Tk. I have followed the instructions using Perlbrew and installed Perl v5.16, Tk-804.027. When I run perl -e "use Tk" I am getting "Can't locate Tk/ in @INC "

cptkrf 07-24-2013 10:51 AM


Originally Posted by jsw2013 (Post 1522691)
I am having trouble installing Tk. I have followed the instructions using Perlbrew and installed Perl v5.16, Tk-804.027. When I run perl -e "use Tk" I am getting "Can't locate Tk/ in @INC "

You updated your .bash_profile, right? I ask because that is close to the error I get when trying to install Tk on the OSX supplied perl.

As to Tk, I just installed both Perlbrew and Tk on a new laptop without error.

The command, "which perl" will confirm it.

jsw2013 07-24-2013 12:22 PM

Installing Tk on OSX
Yes, I did update .bash_profile

I am getting errors in the make process. I think I have no option but to go to Apple support.

Thanks for your input.

cptkrf 07-24-2013 02:08 PM

Do you have either Xcode or (much smaller) GCC-10.x.pkg installed? Otherwise Perlbrew will definitely choke on the make process, since there is otherwise no C compiler available to build anything.

jsw2013 07-24-2013 03:36 PM

Installing Tk on OSX
Yes, Xcode appears to be installed.

cptkrf 07-24-2013 03:50 PM

My bad. Sorry, don't know why I didn't remember, but once I got home and on my programming system, I pulled up my notes. I couldn't get Tk-804.027 installed on Mountain Lion, either. Lots of make errors.

I downloaded Tk-804.030 and that worked. I also have a note that make failed with a different error the first time, but when I issued a "make clean" then started the process again, it completed. Make test, didn't work for some reason I didn't log, but Tk has been working fine with Perlbrew on both a Pro and an Air. (Both with ML)

jsw2013 07-24-2013 04:15 PM

Installing Tk on OSX
Thank you for your comments. I will try installing Tk-804.030 when I get home, some time next week.

Appreciate your input.

cptkrf 04-04-2014 08:32 AM

Here is a better way, if you are on Mountain Lion. Haven't tested it on Mavericks yet. Never could make it work on Lion and previous versions.

login as root in a terminal session and issue the command...

cpan -i Tk

Thats it. It loaded Perl Tk fine on my ML laptop. Just for grins, I tried it again on an old DVD player with Snow Leopard and on a very old Mini with Leopard. Still didn't work.

If someone tries it on Mavericks and it works (or doesn't), please post.

cptkrf 08-01-2014 06:17 PM

Doesn't work on Mavericks.

Using -L/usr/X11R6/lib to find /usr/X11R6/lib/libX11.6.dylib
Cannot find X include files via /usr/X11R6/include
Cannot find X include files anywhere.
No 'Makefile' created'YAML' not installed, will not store persistent state
/usr/bin/perl Makefile.PL -- NOT OK
Running make test
Make had some problems, won't test
Running make install
Make had some problems, won't install
Could not read metadata file. Falling back to other methods to determine prerequisites

cptkrf 08-03-2014 01:37 PM

It ain't gonna work on Mavericks in native mode apparently - at least not without more work that I want to put in it, and to just get undone on the next update of OSX. And almost assuredly it won't work on Yosemite. The best way is to install PerlBrew and maintain an independent Perl.


Several good reasons.
Easy to install.
Tk runs fine.
The Perl install is in your home folder and does not need root permission for install or update or to add Cpan modules.
You can have any version of Perl you want.
If you trash it somehow, just dump the folder and reinstall.
You can easily switch back and forth between system perl and the perlbrew perl.
No chance of hosing up OSX with trying to install languages that Apple doesn't care about.

Bad reasons.
Your bang line will have to be modified if you publish it.

You will need to download the XQuartz dmg from sourceforge to get the X11 stuff if needed.

cptkrf 12-20-2014 02:49 PM

Note to Mavericks users (and I assume Yosemite)...

Don't use the default tk-804.027 from It won't compile.

Use the older page and select the Latest Release at the upper left.
Then download tk-804.032.

Works good and actually runs make test better than a native Debian box.

Again, use PerlBrew so you don't pollute your OSX perl.

cptkrf 03-05-2015 03:12 PM


The above also applies to Yosemite. Works fine.

However, the discussion really relates to Perl in the main, not just Tk. As long as you have the latest Xquartz loaded, it appears that anything from Cpan will run. Except for the bang line having to match Perlbrew, it runs the language as well as a native Linux system.

All times are GMT -4. The time now is 08:05 PM.

Powered by vBulletin
Copyright ©2000 - 2015, Jelsoft Enterprises Ltd.