by WalterGR · 5y ago · 0 comments
"Scripting language runtimes such as Python, Ruby, and Perl are included in macOS for compatibility with legacy software. In future versions of macOS, scripting language runtimes won’t be available by default, and may require you to install an additional package. If your software depends on scripting languages, it’s recommended that you bundle the runtime within the app. (49764202)"
Found via https://mjtsai.com/blog/2019/06/04/scripting-languages-to-be...
python
irb
php --version
tclsh
For PHP, it also shows up in Apache's server string:
Apache/2.4.46 (Unix) PHP/7.3.24-(to be removed in future macOS) mod_perl/2.0.9 Perl/v5.30.2 on hostname
Personally, I've been hoping they'd do this for a while since it's annoying having two versions of each interpreter installed (the system one that can't be updated and the one I installed myself via Mac Ports). Anyone who uses these languages much probably already has a package manager installed. I think they should leave Perl, though, since it's as much as Unix system utility like awk or sed as a programming language.
% /usr/bin/python
WARNING: Python 2.7 is not recommended.
This version is included in macOS for compatibility with legacy software.
Future versions of macOS will not include Python 2.7.
Instead, it is recommended that you transition to using 'python3' from within Terminal.
Python 2.7.16 (default, Mar 25 2021, 03:11:28)
[GCC 4.2.1 Compatible Apple LLVM 11.0.3 (clang-1103.0.29.20) (-macos10.15-objc- on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>
% /usr/bin/python3
Python 3.8.2 (default, Dec 21 2020, 15:06:04)
[Clang 12.0.0 (clang-1200.0.32.29)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> % /usr/bin/python3
xcode-select: note: no developer tools were found at '/Applications/Xcode.app', requesting install. Choose an option in the dialog to download the command line developer tools.I don't like how Apple handles this. If you have the developer tools installed, it's not especially obvious what is part of those tools and what is actually bundled with the OS. And so it's not surprising that some scripts I've come across will silently break in semi-odd ways without the dev tools.
Also, why is Python a developer tool, but Perl isn't? Or ZSH, for that matter? Does the distinction actually make any sense?
I really have no issue with Apple trimming down the surface of the OS to a minimum.
I don't know if any "native" apps have leveraged them, though. That would be the real risk of disruption.
Also, as someone who never uses PHP, I'd really rather not have it on my machine. Scripting languages are a pretty big attack surface, even if it's just to pivot after initial compromise. I'd rather not have one there that's not being used.
It is weird to me the number of times 90's Linux Distros used Perl for things that are easy in awk, awk for things that are easy with cut, and other commands for things that are easy with POSIX shell baked-in facilities. I guess I'm just a shell snob.
So because you can't trust cut to do what you want, you'll probably reach for something like awk '{print $3}' instead.
Most of the time the script doesn't get more complicated and it's fine with cut/sed/wc etc, but at some point it tips the balance and I grumble to myself.
Even those tools suffer from Apple's lack of fucks given. I often have to replace included system commands with the homebrew equivalent because Apple's is missing some common functionality.
I wish Apple would just adopt homebrew as a firstparty package manager.
Before someone shares some bizarre workaround: no thanks.
• https://github.com/Homebrew/brew/issues/10127#issuecomment-8...
Usually it's one or the other.
And while you can still find an traditional unix(tm) box here and there in the dusty forgotten corners of enterprise serverooms(i am personally responsible for maintaining a few hpux boxen), unix(tm) certification haven't really mattered since Linux became serious business which happened around the same time OSX was launched.
What used to matter was that you could run the same CLI tooling in an macos desktop as on an Linux server but i don't think this is an use case apple see's as particularly important for the future success of Apple.
But it might help Apple to win government contracts.
% perl -de1
WARNING: This version of perl is included in macOS for compatibility with legacy software. In future versions of macOS the perl runtime will not be available by default, and may require you to install an additional package.
However, how come things break when Perl is upgraded? From what I've heard, Perl should be extremely backwards compatible. What am I missing?
Those aren't an "incompatible changes seection".
perldelta covers bugfixes, feature additions etc.
Post-upgrade either various modules weren't found (because they were installed in a versioned path), or they didn't compile because the XS components had been compiled against the prior version of Perl.
I will often use the system perl to bootstrap https://p3rl.org/Perl::Build which makes building -one- perl for local use easier than perlbrew/etc. - and then https://p3rl.org/App::plx for managing per project environments if I need that
The way it is written, it sounds like they are trying to hide the fact that said "legacy software" is part of the (new) system itself. Otherwise they wouldn't need to include it in the base install.
> Python, Ruby, and Perl
The order they use for the languages hides the fact that, at least for Catalina, Perl is by far the most used scripting language by core elements of macOS, even more than the shell. Check it by yourselves:
file -b /{usr/,}{s,}bin/* |cut -d\ -f1,2|sort|uniq -c|sort -n|tail
13 setuid Mach-O
23 a /usr/sbin/dtrace
50 a /usr/bin/perl5.28
53 a /usr/bin/perl5.18
81 POSIX shell
116 Perl script
954 Mach-O 64-bit
Conclusion: Apple is a Perl shop.And of course compile their scripts into executables or something.
It "lowers the friction of curiosity".
(And, it allowed our shadow IT custom request system and automation package to be built in 2014. I hope RHEL never takes this away).
I recently wrote a short Ruby program to help my not-computer-literate-at-all mother automate a task that would've taken hours and hours to do manually. She's barely comfortable using GUI programs, but because Ruby was already installed and I was able to give her clear directions she was able to run the program in Terminal.app without much trouble. It would've been frustrating as hell to remotely get her set up with homebrew (or whatever the new hotness is in package managers nowawadays), install the right version of Ruby, fix any $PATH shenanigans, etc.
(There was still some trickiness because her included version of Ruby was super old and couldn't install gems because it used an old version of SSL/TLS, but we were able to figure out a workaround)
Or default python2 breaking stuff that assume you have a recent install