Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.

share|improve this question

6 Answers 6

up vote 4 down vote accepted

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
share|improve this answer

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.

share|improve this answer

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

share|improve this answer

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.

share|improve this answer
1  
It'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 Nov 29 '09 at 22:11
    
I wouldn't overwrite the default installation, I meant install a new installation in a separate directory. –  gorilla Nov 30 '09 at 1:32
1  
Gotcha, but that still doesn't fix his broken default Perl. –  Lawrence Velázquez Nov 30 '09 at 5:18
    
Regarding overwriting the default perl, see stackoverflow.com/questions/1992720/… –  Ether Jan 24 '10 at 9:12

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.

share|improve this answer
    
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 Dec 14 '09 at 9:39
    
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 Dec 15 '09 at 0:50
    
For the interested: the flash stability had to do with audio in flash video and an incompatibility in Audio Hijack Pro. See: superuser.com/questions/83315 –  dlamblin Mar 19 '10 at 18:30

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]
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.