Installing Tk on OSX

Joined
Jun 25, 2013
Messages
4
Reaction score
0
Points
1
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/Event.pm in @INC "
 
Joined
Dec 8, 2009
Messages
453
Reaction score
10
Points
18
Location
The same as Sheldon Cooper - East Texas
Your Mac's Specs
iMac 2014 i5 5k 32gb 1tb fusion, second TB display, 2014 MBA
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/Event.pm 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.
 
OP
J
Joined
Jun 25, 2013
Messages
4
Reaction score
0
Points
1
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.
 
Joined
Dec 8, 2009
Messages
453
Reaction score
10
Points
18
Location
The same as Sheldon Cooper - East Texas
Your Mac's Specs
iMac 2014 i5 5k 32gb 1tb fusion, second TB display, 2014 MBA
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.
 
Joined
Dec 8, 2009
Messages
453
Reaction score
10
Points
18
Location
The same as Sheldon Cooper - East Texas
Your Mac's Specs
iMac 2014 i5 5k 32gb 1tb fusion, second TB display, 2014 MBA
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)
 
OP
J
Joined
Jun 25, 2013
Messages
4
Reaction score
0
Points
1
Thank you for your comments. I will try installing Tk-804.030 when I get home, some time next week.

Appreciate your input.
 
Joined
Dec 8, 2009
Messages
453
Reaction score
10
Points
18
Location
The same as Sheldon Cooper - East Texas
Your Mac's Specs
iMac 2014 i5 5k 32gb 1tb fusion, second TB display, 2014 MBA
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.
 
Joined
Dec 8, 2009
Messages
453
Reaction score
10
Points
18
Location
The same as Sheldon Cooper - East Texas
Your Mac's Specs
iMac 2014 i5 5k 32gb 1tb fusion, second TB display, 2014 MBA
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
SREZIC/Tk-804.032.tar.gz
/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
 
Joined
Dec 8, 2009
Messages
453
Reaction score
10
Points
18
Location
The same as Sheldon Cooper - East Texas
Your Mac's Specs
iMac 2014 i5 5k 32gb 1tb fusion, second TB display, 2014 MBA
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.

Perlbrew

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.
 
Joined
Dec 8, 2009
Messages
453
Reaction score
10
Points
18
Location
The same as Sheldon Cooper - East Texas
Your Mac's Specs
iMac 2014 i5 5k 32gb 1tb fusion, second TB display, 2014 MBA
Note to Mavericks users (and I assume Yosemite)...

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

Use the older search.cpan.org 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.
 
Joined
Dec 8, 2009
Messages
453
Reaction score
10
Points
18
Location
The same as Sheldon Cooper - East Texas
Your Mac's Specs
iMac 2014 i5 5k 32gb 1tb fusion, second TB display, 2014 MBA
Update:

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.
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top