Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

And why are they so small? (my perlbrew 5.38.2 is 3.4M)
/usr/bin/perl		v5.30.3	169,856 bytes executable
/usr/bin/perl5.30	v5.30.3	134,608 bytes
/usr/bin/perl5.34	v5.34.0	134,608 bytes
There are 3 copies of everything in /usr/bin:
perldoc			811 bytes executable
perldoc5.30		297 bytes
perldoc5.34		297 bytes
Core modules for each version:
/System/Library/Perl/5.30
/System/Library/Perl/5.34
Older versions of macos had two copies of everything in /usr/bin but they were the same version of perl. This is on macOS Sonoma 14.3 version 23D2057. The question arises from Re^2: object version does not match.
  • Comment on Why does Apple Mac ship with TWO versions of Perl??

Replies are listed 'Best First'.
Re: Why does Apple Mac ship with TWO versions of Perl??
by tonyc (Hermit) on May 13, 2024 at 22:47 UTC

    /usr/bin/perl isn't a perl binary in this case, but what appears to be a wrapper that calls whichever version of perl is configured. I don't know how that is configured, though the answer here for python can probably be adapted.

    If you run VERSIONER_DEBUG=1 perl -v you'll see some of the output from this process.

    The actual perl binaries are this small because perl was built with -Duseshrplib which moves most of perl into a shared library. This is common for vendor built perls, since it allows the same shared library to be shared between the perl binary and embedded perls, such as mod_perl2. It can also simplify security updates, since minor fixes only require updating the perl package including the shared library.

    I don't know why there are two versions installed

Re: Why does Apple Mac ship with TWO versions of Perl??
by Anonymous Monk on May 10, 2024 at 01:00 UTC
    /usr/bin/perl5.30 -V >p530;/usr/bin/perl5.34 -V >p534; diff -y p530 p5 +34
    bincompat5005=undef			<
    Compiled at Dec 21 2023 03:10:25	| Compiled at Dec 21 2023 03:10:36
    
    Also
      @INC:
        /Library/Perl/5.30/darwin-thread-multi-2level
        /Library/Perl/5.30
        /Network/Library/Perl/5.30/darwin-thread-multi-2level
        /Network/Library/Perl/5.30
        /Library/Perl/Updates/5.30.3
        /System/Library/Perl/5.30/darwin-thread-multi-2level
        /System/Library/Perl/5.30
        /System/Library/Perl/Extras/5.30/darwin-thread-multi-
        /System/Library/Perl/Extras/5.30	
    
    The only folders in this @INC that exist are the /System folders containing core modules, and /Library/Perl/5.30 with this one file:
    cat /Library/Perl/5.30/AppendToPath
    /System/Library/Perl/Extras/5.30

    /Network does not exist. Remnants of the build process for macOS?