in reply to Broken /usr/bin/perl

The older version (presumably Apple original) in /usr/local/bin has no such problem.

Uh. Multiple screw up here. Local overrides reside in /usr/local, the shipped stuff should be in /usr as moritz pointed out. On any sane system, /usr/local/bin comes first in $PATH overriding /usr/bin. You might want to file a bug report against Apple for that.

As a quick fix, check your preferred perl's include path via perl -V. If your system's stuff (/usr/local/...) comes first, recompile adjusting the search path. You could also try adding a LD_LIBRARY_PATH variable (similar to $PATH) to your profile containing the correct directories in which the correct shared objects are residing, and, to use the correct modules for your preferred perl, a $PERL5LIB setting (see perlrun).

Replies are listed 'Best First'.
Re^2: Broken /usr/bin/perl
by telemachus (Friar) on May 04, 2009 at 00:03 UTC

    Uh. Multiple screw up here. Local overrides reside in /usr/local, the shipped stuff should be in /usr as moritz pointed out. On any sane system, /usr/local/bin comes first in $PATH overriding /usr/bin. You might want to file a bug report against Apple for that.

    Well, as far as that goes, OS X is not sane. The default $PATH looks like this:

    /usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin

    One of the first things I do on a new OS X system is adjust that to put /usr/local earlier. (I would also be shocked if filing a bug at Apple did squat. OS X is not built for developers who want to install software they compile themselves. The system has no compiler unless you install the extra, optional X Code tools.)

    @Moritz: OS X doesn't really come with any package installer, if by 'package installer' you mean something like apt-get or yum. If you remove (or muck with) the system's Perl, I don't think it would be especially easy to fix that.

    @Cmac: I think that you have it backwards. The built-in, Apple-provided Perl lives in /usr/bin. The custom one that you (or someone else) built or installed later should be in /usr/local. So the Perl that is messed up is apparently Apple's. There are some tips here about how you might try to reinstall up the system-wide Perl if you've tampered with it. But the author describes it as "much like conducting brain surgery to yourself. Without anesthesia." So, that's a last resort apparently. Try to remove the stuff in /usr/local first. It should be easy enough to recompile that on your own, if you decide that you want it back. I hope this helps.

    Edit: to answer your question, you can't reinstall Perl simply by reinstalling X Code. Perl is part of the base installation packages. And you can't normally get at the individual items separately. The program Pacifist, available here, can apparently extract individual items, but I've never tried it. So I can't say one way or another how easy it is to use, how cleanly it works (or not), etc.