View Single Post
cptkrf

 
Member Since: Dec 08, 2009
Location: The same as Sheldon Cooper - East Texas
Posts: 362
cptkrf is a jewel in the roughcptkrf is a jewel in the rough
Mac Specs: MacMini,2013, Intel Core i7, 16gb, 27" Thunderbolt display (Highly recommended!)

cptkrf is offline
I have used Perl and Perl/Tk for several years. It was one of the reasons that I swapped over to OSX from Linux. Unfortunately, the Apple engineers don't make it easy. Many times incremental updates to OSX will break it, and major upgrades to a new version of Cat always do.

So, here is an easy way to install an independent Perl on your system in the Home folder that will be out of the line of fire by the App Store. It won't change OSX in any way so you won't unhook the Apple Perl installation.

If you want to get rid of all of it, just dump ~/home/perl5 in the trash and take the source line out of .bash_profile. Your system will be back like it was before you started.



1. Install Xcode. If you want to hack, you don't need the entire suite and you can just install the Unix utilities. But, I have found that this usually gets wrecked on the next update of Xcode. So, I recommend that you get the whole thing.

The following commands are run in a terminal window.

2. Install perlbrew with the command… (you can visit the website with Perlbrew . I know that doesn't look like a URL, but it is.)
curl -kL http://install.perlbrew.pl | bash

3. After the above install, put the following into your ~/home/.bash_profile. You will probably have to create the file, since most installs of OSX don't have it.
source ~/perl5/perlbrew/etc/bashrc

Exit the terminal window and start another so your login reads the new .bash_profile

4. Load which ever perl you want, with… (5.14.2 is the latest stable as of this writing.)
perlbrew install perl-5.14.2

5. Tell your system about it with...
perlbrew switch perl-5.14.2

Note that you can load as many different perl versions as you wish.

Log out of your current terminal, then open up another one, so your .bash_profile gets read.

Run…
perl -V
…and you should get something like this...

…bunch of stuff...

@INC:
/
/Users/home/perl5/perlbrew/perls/perl-5.14.2/lib/site_perl/5.14.2/darwin-2level
/Users/home/perl5/perlbrew/perls/perl-5.14.2/lib/site_perl/5.14.2
/Users/home/perl5/perlbrew/perls/perl-5.14.2/lib/5.14.2/darwin-2level
/Users/home/perl5/perlbrew/perls/perl-5.14.2/lib/5.14.2




You should be ready to go.

In your perl program bang line, replace #!/usr/bin/perl with #!/Users/home/perl5/perlbrew/perls/perl-5.14.2/bin/perl
This is the way to point your script to which ever perl you want to use. In this case, 5.14.2

Now, just install Tk (or any other CPAN module) the usual way with perl Makefile.PL, make, make test and make install. The make install now doesn't have to be done with root authority.

This install was tested on Lion and should work on Leopard, Snow Leopard, and survive the upgrade to Mountain Lion.
QUOTE Thanks