Messed up my perl install on Mac OS X 10.6

4

4

I have messed up my perl install on Mac OS X 10.6. I'll explain how:
I wanted to add a cpan package for Bundle::DBD::mysql, cpan told me to update Bundle::CPAN first. I couldn't because of permissions. So I sudoed perl -MCPAN -e shell and updated cpan, then I got the mysql bundle, but it failed some tests, which I then forced the install (it works btw). Then for some reason I decided to rebuild the mysql bundle. This took a long long time. Eventually I realized it had rebuilt a lot, like perldoc.

Now whenever I try and run perldoc I haven't the permission to do so, but when I sudo perldoc to tells me it can't find it.

dlamblins-macbook:~ dlamblin$ perldoc
-bash: /usr/bin/perldoc: Permission denied
dlamblins-macbook:~ dlamblin$ sudo perldoc
Password:
sudo: perldoc: command not found
dlamblins-macbook:~ dlamblin$ sudo /usr/bin/perldoc
Password:
sudo: /usr/bin/perldoc: command not found

I'd like to reinstall perl for real the way Apple installed it when I updated to Snow Leopard (though keeping DBD::mysql would be nice), and I don't know where to start. I do not want to go with some fink package or ports styled system. Getting the latest perl 5.10 would be a plus.

dlamblin

Posted 2009-11-28T07:29:18.203

Reputation: 9 293

Answers

3

This may seem like I'm a total Mac Newb (though I've used a Mac since the LC) but since installing the combined update for 10.6.2 didn't fix this issue even though it overwrote the files, I realized belatedly that Disk Utility's "Repair Permissions" button would fix it. And it did.

The odd thing is the actual binary /usr/bin/perldoc wasn't touched. It's probably got something to do with one of those bundles in the output.

Here's what it output as it fixed stuff (note the last line is a ? for me)

Repairing permissions for “Macintosh HD”
Permissions differ on "private/etc/postfix/main.cf.default", should be -rw-r--r-- , they are -r--r--r-- .
Repaired "private/etc/postfix/main.cf.default".
Permissions differ on "usr/bin/c2ph", should be -rwxr-xr-x , they are -rw-rw-rw- .
Repaired "usr/bin/c2ph".
Permissions differ on "usr/bin/config_data", should be -rwxr-xr-x , they are -r-xr-xr-x .
Repaired "usr/bin/config_data".
Permissions differ on "usr/bin/cpan", should be -rwxr-xr-x , they are -r-xr-xr-x .
Repaired "usr/bin/cpan".
Permissions differ on "usr/bin/enc2xs", should be -rwxr-xr-x , they are -r-xr-xr-x .
Repaired "usr/bin/enc2xs".
Permissions differ on "usr/bin/instmodsh", should be -rwxr-xr-x , they are -r-xr-xr-x .
Repaired "usr/bin/instmodsh".
Permissions differ on "usr/bin/piconv", should be -rwxr-xr-x , they are -r-xr-xr-x .
Repaired "usr/bin/piconv".
Permissions differ on "usr/bin/prove", should be -rwxr-xr-x , they are -r-xr-xr-x .
Repaired "usr/bin/prove".
Permissions differ on "usr/bin/shasum", should be -rwxr-xr-x , they are -r-xr-xr-x .
Repaired "usr/bin/shasum".
Permissions differ on "usr/share/derby", should be drwxr-xr-x , they are lrwxr-xr-x .
Repaired "usr/share/derby".
Permissions differ on "Library/Perl/5.10.0/darwin-thread-multi-2level/NetSNMP/default_store.pm", should be -rw-rw-r-- , they are -r--r--r-- .
Repaired "Library/Perl/5.10.0/darwin-thread-multi-2level/NetSNMP/default_store.pm".
Permissions differ on "Library/Perl/5.10.0/darwin-thread-multi-2level/auto/NetSNMP/default_store/autosplit.ix", should be -rw-rw-r-- , they are -r--r--r-- .
Repaired "Library/Perl/5.10.0/darwin-thread-multi-2level/auto/NetSNMP/default_store/autosplit.ix".
Permissions differ on "Library/Perl/5.10.0/darwin-thread-multi-2level/auto/NetSNMP/default_store/default_store.bundle", should be -rwxrwxr-x , they are -r-xr-xr-x .
Repaired "Library/Perl/5.10.0/darwin-thread-multi-2level/auto/NetSNMP/default_store/default_store.bundle".
Warning: SUID file "System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/MacOS/ARDAgent" has been modified and will not be repaired.

Permissions repair complete

dlamblin

Posted 2009-11-28T07:29:18.203

Reputation: 9 293

3

Try using Pacifist to run the appropriate Installer package from your 10.6 disc. I am not sure which package it is off the top of my head, but Pacifist lets you browse and search the packages on disc. I don't believe it will remove new files, but it'll restore your Perl installation to the working default. You can also selectively extract files and folders.

Using Pacifist to search for "Perl" on the Mac OS X 10.6 disc.

I used it a couple of years ago to do damage control (quite successfully, I might add) following a rather embarrassing incident involving sudo rm -fr /bin. Don't ask.

Lawrence Velázquez

Posted 2009-11-28T07:29:18.203

Reputation: 929

2

Yep...Disk Utilities "Repair Permissions" worked for me as well. Same problem...installed the DBD::mysql module and it hosed up the permissions.

Kevin

Posted 2009-11-28T07:29:18.203

Reputation:

1

You can always download the latest perl from http://www.cpan.org/src/5.0/latest.tar.bz2.

You'll need to unarchive, and run Configure.

I personally usually prefer having my own installation of perl, even when the basic OS included a version. That means that my scripts can be upgraded to later versions on my schedule, not the maintainers.

gorilla

Posted 2009-11-28T07:29:18.203

Reputation: 2 204

Regarding overwriting the default perl, see http://stackoverflow.com/questions/1992720/perl-strategy-for-a-new-snow-leopard-user/1992934#1992934

– Ether – 2010-01-24T09:12:16.117

1It's not a particularly good idea to overwrite the default Perl installation with a custom one, since software updates and the like may make assumptions regarding the default system Perl. If you're going to roll your own Perl, it's best to install it to /usr/local or another out-of-the-way location.

In any case, he's still going to have to fix his system Perl. – Lawrence Velázquez – 2009-11-29T22:11:04.373

I wouldn't overwrite the default installation, I meant install a new installation in a separate directory. – gorilla – 2009-11-30T01:32:18.253

1Gotcha, but that still doesn't fix his broken default Perl. – Lawrence Velázquez – 2009-11-30T05:18:27.543

1

maybe it helps to install the latest update under http://support.apple.com/kb/DL959. i had massive problems after an full system restore with time machine. it seems that this corrupts many things and i couldn't use quicklook anymore besides other stuff. after reinstalling this update all functions as normal. with a little bit of luck perl is in this update.

fin

Posted 2009-11-28T07:29:18.203

Reputation: 1 806

For the interested: the flash stability had to do with audio in flash video and an incompatibility in Audio Hijack Pro. See: http://superuser.com/questions/83315/

– dlamblin – 2010-03-19T18:30:24.940

I tried this and it did not work. It did however fix the mysterious hard-hanging flash plugin which had been the bane of youtube (and other flash video) since updating to the improved "safari plugin stability". Re-installing resolved this, but not my perldoc permission issue. – dlamblin – 2009-12-14T09:39:35.790

Actually this flash plug in stability thing comes and goes; it goes with a restart and I don't know what causes it yet. – dlamblin – 2009-12-15T00:50:08.083

0

Installed fresh CPAN on Lion.

Before Disk Utility's "Repair Permissions":

$ perldoc
-bash: /usr/bin/perldoc: Permission denied

Works again after:

$ perldoc
Usage: perldoc5.12 [-h] [-V] [-r] [-i] [-D] [-t] [-u] [-m] [-n nroffer_program] [-l] [-T] [-d output_filename] [-o output_format] [-M FormatterModuleNameToUse] [-w formatter_option:option_value] [-L translation_code] [-F] [-X] PageName|ModuleName|ProgramName
       perldoc5.12 -f PerlFunc
       perldoc5.12 -q FAQKeywords
       perldoc5.12 -v PerlVar

The -h option prints more help.  Also try "perldoc perldoc" to get
acquainted with the system.                        [Perldoc v3.15_02]

bbaassssiiee

Posted 2009-11-28T07:29:18.203

Reputation: 1 225