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.


In reply to Re^2: Broken /usr/bin/perl by telemachus
in thread Broken /usr/bin/perl by cmac

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.