404 points · by ingve · 5y ago · 407 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 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.
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.
• https://github.com/Homebrew/brew/issues/10127#issuecomment-8...
% 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?
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.
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
Dropping PHP is irritating because PHP is actually a really good shell scripting language and it’s universal availability on macOS made distributing simple CLI tools for Mac written in PHP as a simple script or a bundled PHAR easy as pie.
I have a decent number of macOS specific tools I distribute as PHP, many 10+ years old, and I can guarantee almost none of my users have any idea what PHP is let alone how to install it.
For end users, the interpreter can be bundled with the application, that is much more stable for everyone.
As long as it's trivial to install after purchase, the removal of this sort of thing is in no way concerning to me. When I've written things natively on my Mac, I've almost ALWAYS had to go get an updated version of perl / python / ruby / whatever to get current.
I currently have over 5 different python versions installed to be able to test against them. The different software I work gets deployed to different environments and I have all those versions installed locally to test.
For end users, it doesn't matter as long as it works. The less moving pieces, the better. A bundled interpreter in the OS gives a stable platform to develop against.
The interpreter can be bundled with the application, of course. But now you have n different interpreters with their own php.ini files and their own set of things to change. Upgrading the application means overwriting those files and causing more pain when they have to figure out why something stopped working.
But it wouldn't be stable. Or it would be, but it would be hopelessly out of date.
Apple can either keep the bundled interpreters on the same version forever, or they can update it with the OS. Do the former, and it becomes hopelessly out of date. Do the latter, and software updates randomly break stuff.
Either the language developers need to actually keep their languages stable, or everyone else just needs to get used to keeping multiple versions around.
I can understand what you wish for. But what you wish for is very far from what we’ve had so far. Time to accept reality.
That's absurd. Five versions of the same language. Each with their own package folders. That's at least 15 GB.
This is a luxury and consequence of infinite compute resources.
good luck with that
/usr/bin/php --version
WARNING: PHP is not recommended
PHP is included in macOS for compatibility with legacy software.
Future versions of macOS will not include PHP.
PHP 7.3.24-(to be removed in future macOS) (cli) (built: Dec 21 2020 21:33:25) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.24, Copyright (c) 1998-2018 Zend Technologies
so, 7.4 or 8?I'm still using 7.x due to limitations.
This seems like a net positive change to me and I hope they can keep dropping these built in languages.
Wondering if it was really an issue with 2 interpreters or more of an issue with how the system works. More specifically PATH variables, shebangs and prioritizing your custom one over the system one.
Faster.
> Perl
More readable and writeable, and probably more popular in the past fifteen years.
> Ruby
Again faster.
You're confusing PHP's general popularity for web development with it's popularity as a command-line scripting language. There's no way PHP is more popular than Perl for non-web scripting. Unlike Perl, PHP was never designed as a general purpose language.
Try writing a PHP script which has to parse command line options. It ain't pretty. Python, Ruby and Perl were designed for this. PHP was not.
PHP is extremely fast for scripts written in raw, procedural PHP but its shared nothing design makes it a liability with large frameworks such as Laravel and Symfony. In many tech empower benchmarks Django and Rails are listed ahead of Laravel.
With PHP the speed should not be CPU related, but instead IO. PHP IO is HORRIBLE, and a default setup using framework <insert here> usually peaks around 300-600 req/sec which is almost laughable in 2021.
Not that it really matters, but for CPU stuff numpy is multitudes faster than a PHP counterpart. Pypy also usually is lots faster than PHP for a given task.
It’s just as valid a language for shell scripts as any other.
Pretty much every other option falls down in some way:
* Dart, Rust, Node etc. don't let you use just a single file like Python does.
* Python is very slow and it's type annotation system is better than nothing but is still the worst I have used.
* Everything except maybe Go requires you to list dependencies in a separate file, which rules out single-file scripts.
Deno is easily worth the installation effort, especially since it's so easy to install. You'd be really mad to stick with PHP.
If you're developing anything and don't know how to configure your tools, I'm not sure what to say.
I use scripts written in Ruby reasonably often without _any_ understanding of how the Ruby ecosystem works. I just want to run the tool, and the tool happens to be written in Ruby.
If someone really wants to still keep on using PHP its just a brew install away.
I get it, it sucks that PHP has been getting badmouthed every time it's mentioned but let's not overcorrect.
In PHP you really need to know what version you are working with, otherwise weird stuff happens.
Docker is horribly slow on macOS. I'd wish that on no developer. We had to use docker for one project, but quickly decided to just run the tests in Docker and let the developers figure their environments out by themselves.
That means that whenever you call Docker, it has to copy your "context" to the virtual machine, then actually run the Docker invocation inside the VM. This gets slow and annoying very fast for even 10MB "contexts".
"Context" is anything in your working directory, more or less.
I’ve never been super happy with Docker for Mac. I did a pretty deep dive into figuring out why it’s so slow with no satisfying conclusion: https://stackoverflow.com/q/58277794/30900
True of Windows too.
The overhead should be incredibly minimal.
It is a waste of time though. Just use Linux.
https://www.jeffgeerling.com/blog/2020/revisiting-docker-mac...
Alternatively, if you are running Docker Compose, you can use two mounts and a volume. I'm assuming your application is a standard Symfony/Composer application, checked out in $HOME/Projects/foo:
1) $HOME/Project:/var/www
2) some-volume:/var/www/vendor
Then, once the containers are created, run composer install inside the container, and then either run it again on the host or copy the files over using docker cp so that your IDE picks up the dependencies.
For more complex stuff such as Drupal where you also have to account for web/modules/contrib, web/themes/contrib and the likes, you'll need to do the volume trick once again for each Composer-installed folder.
The result will be that the tens of thousands of files that Composer installs and each request requires will be inside the Linux VM without any performance impact, whereas the dynamic files you are using for development will be instantly available in the VM.
Long term I'd really wish if Docker for Mac/Windows could use inotify, on-demand synchronization plus a boatload of caching to get the performance issues under control. Oh, and while we're at it, it really really sucks that "host.docker.internal" is only available on Macs - you need that one to get xdebug to connect back to the "host", so you need two separate Docker Compose files, one for Mac developers and one for Linux developers.
Sigh.
It is certainly no longer a problem for my dev work since a certain docker version upgrade.
Not sure what you mean by "serious", but I get paid for doing webdev (Rails) on an ARM Mac and we deploy to x86 Linux boxes and our only environment is Gemfile.lock, yarn.lock and roughly the same DB version. I don't remember ever having problems with that.
I'm not meaning to say that you yourself are not a serious developer, nor that webdev is not "serious development", but if you do this long enough you will encounter a problem that happens in production that can't be reproduced in your dev environment.
Yes, it's a good idea to have your development environment mimic production as closely as is practical, even if it's not something that you currently practice.
I prefer if my team develops on different operating systems or Linux distributions and point realeses, not only for early catching of weird behavior but also usually this will in the long run eliminate any environment assumptions in the source code and thus create a cleaner code base.
If it is necessary to replicate an exact production behavior I have staging for that.
Maybe your definition of "serious development" is whatever is around your current level instead of something objective?
The "non-serious" sort of development mentioned was more where you'd be dealing with a large number of tools without any builder-tool to ensure uniform versioning.
A patently false generalization.
There are many reasons to avoid using Docker, besides the fact that it is a dumpster fire managed by a failing company.
The new M1 macbooks couldn't even run Docker, which was enough to get the last holdouts of my dev team to switch to just properly managing their local environments.
Docker can be useful, but more often than not it is a crutch used to make up for the fact that many web developers don't really know how to properly manage their machines.
Docker has worked on M1 Macs since... mid-December of last year. Less than a month after they were released? Why was anyone on your "dev team" using M1 Macs within weeks of launch? At that point, even installing things with Homebrew required compiling everything from scratch. Not a very great use of developer time.
> more often than not it is a crutch used to make up for the fact that many web developers don't really know how to properly manage their machines.
This is like saying that an electric starter is a crutch, and Real Drivers relish the opportunity to spend 20 minutes using a crank starter to "properly" start their car's engine every time they need to go somewhere. No thanks. Like using a crank starter, managing a bespoke local environment is not some incredible skillset, even though you seem to be giving yourself a nice pat on the back for it. It's simply a questionable use of developer time, and doubly so if all of your production environments aren't identical.
We have a BYOD policy, and several members of my team opted to get the new M1. They were junior devs who didn't know better not be early adopters. I agree that it was a huge waste of time, and Docker was a major contributor to that.
Your analogy about starters doesn't really make sense. We aren't the driver, we are the mechanic, and we should know how the engine works in its entirety. Managing a local environment is a skill set, and frankly it is a skill set that many developers lack.
You can keep using docker if you want, I don't really give a shit. Its dead end tech that will be replaced in a few years by some new startup, while the *NIX systems using it will still be there and the developers reliant on docker will have to learn a new ephemeral skill set.
I also maintain a WSL Ubuntu setup to provide support for our windows developers. I suppose WSL is a VM.
[0] - httpss://channel9.msdn.com/Blogs/Seth-Juarez/Windows-Subsystem-for-Linux-Architectural-Overview
[1] - https://www.microsoft.com/en-us/research/project/drawbridge/
One great thing about Gentoo is that you can have multiple versions of packages like PHP, so you can run legacy and the newest, at the same time, on the same system, without having to deal with docker.
I think this might be why there's a split, I use docker but I don't work on just the one site
In fact, thanks to consulting across .NET, Java and C++, targeting mobile, desktop and Web, I have plenty of tools installed and configured for each project.
(Please don't waste your time replying with "I can't use X because of Y". The world does not need any more of these anecdotes. We've heard it all. If you don't want to be a part of the change, downvote and move on.)
Docker is about 5 years time to become irrelevant, replaced by the next big thing(TM) in cloud deployments.
lolwut? Most of us have been using homebrew longer than docker has been popular, often codebases older than that, too. If anything, it takes far more hoop jumping for the average user to run a full 1:1 VM on OSX.
Also considering Mac's still on like bash v0.0.4 or something I'd rather be able to install the latest version of stuff as and when I need it (or use docker anyway making the whole thing moot as you say)
off topic: WHY does mac's `rm` not support the -rf flag being at the end of the command dammit. I don't trust myself putting it up front haha
Using Docker during development is not required and in fact not always ideal.
This kind of HN elitism bothers me. PHP built its reputation on quick 'n dirty hacks which were easy to deploy on cheap hosting not by aping the infrastructure of some tech giant with fleets of servers, which is what Docker was originally designed for. The average PHP dev relying on the version which comes with the OS is most certainly not using Docker. Most home broadband upload speeds make Docker a non-starter.
Windows doesn't come with PHP, Python, or Ruby preinstalled, either.
In the age of CD-ROMs shipped with magazines, sure including a 'blessed' version of most programming languages made sense. Saved the average Linux geek from needing to hunt down a separate (physical!) package for PHP or whatever.
Now, the same reasoning applies to Linux as to MacOS. Unless the OS itself relies on them (Perl?), including some random version of various PLs makes as much sense as including a bunch of shareware games.
But even for the non-critical software, packaged WP needs PHP, packaged Vagrant needs Ruby etc.
As for enterprise Linux, many customers relies on this packages, because they get reviewed and gets security patches on system updates.
Honestly I wouldn't mind if some distros ditched the "blessed" version altogether for non-system languages. I can't remember the last time I used the default PHP in CentOS, it's always grossly outdated. But distros like Debian have a policy of packaging any open-source program they can get their hands on and keeping them up to date, at least when it comes to security fixes. It's their choice if they want to provide that service to their users, and many users like it.
Removing general-purpose languages from operating systems makes a certain kind of sense, but it also pushes further in the direction of computers being devices for consumption, not creation.
But I guess MacOS is more of a frontend for Electron apps now so it's less important when the logic is to just bundle everything needed in 1GB+ executables.
(I'm not joking. PHP contains some very small PNG logos displayed in phpinfo(), one of which is an Easter egg that only appears on certain dates.)
EDIT: Ah, the Easter egg logo was changed with PHP 8. Well, some other elePHPant gets to be sad instead. :p
$ php --version
WARNING: PHP is not recommended
PHP is included in macOS for compatibility with legacy software.
Future versions of macOS will not include PHP.
PHP 7.3.24-(to be removed in future macOS) (cli) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.24, Copyright (c) 1998-2018 Zend TechnologiesApparently Apple prefers compiled binary for everything.
Am not complaining. The included Apache/MySQL servers were too old and I had to install those anew. But that always collided with the stock installed one.
It's good that Apple getting rid of those. Install what you need afresh.
If you're an Apple exec it's hard to ignore that iOS succeeded fine with just bundling everything into self contained apps. They definitely see this is as the future and the old model as the past.
I just ran a version check on Python (2 and 3), Ruby, and Perl, and none of them said anything to the tune of "will be removed soon". (MacOS 11)
haha, I know it is a generic warning, but that is pure gold :D
People are weird.
If their policy is to freeze whatever version they could get their hands on at release time and ignore security fixes afterward, I would say good riddance. Third-party repos would do a much better job.
I would consider teaching students the skeletal basics of Homebrew to be a valuable pillar of their ability to perform webdev workplace duties using a Mac.
I would consider teaching students the deep details of trying to build their own python and ruby on Mac to not be a valuable pillar of their ability to perform webdev workplace duties using a Mac.
So I don't see how there's any alternative to Homebrew, not if they want to prepare their students for today's reality. "Use what's preinstalled with a Mac" is no longer a viable solution, and in my best judgement Homebrew is the minimum work necessary to get them from zero to ready. If there are alternatives that are as simple as Homebrew to have students deploy and maintain as a teacher, we'd all love to learn more about them.
Apple did start to have a binary in the default location that was really a chooser that would respect per-user settings and re-direct you (exec) to the "right" install, but they seemed to have backed off on that.
Please don’t frame your personal opinions as assumption-laden questions. If you think PHP isn’t worth it, then say that directly and openly. Framing your belief as a loaded question is not conducive to good discussion.
Simple answer: https://w3techs.com/technologies/overview/programming_langua...
What language would you pick for that?
I mean, it was far better than on Windows where you need to install some bundled package from a third party to just get hello-world running.
% httpd -v
Server version: Apache/2.4.46 (Unix)
Server built: May 22 2021 02:05:58
on macOS 12 beta. alias php='docker run --rm -ti php:pick-your-version'
I write a fair amount of PHP on Linux and I haven't had php actually installed for years.Not a big miss.
Brew install php
I’ve always used the latter, seldom had any problem with it, and found the community great when I did. I prefer it because it installs everything related to it in its own directory totally separate from the default OS, in one place. I find that more organized. There’s been times where there was no homebrew equivalent for a macports package. Also I remember hearing (if I’m not mistaken) that macports was used more internally at Apple(?)
In any case I’m surprised it’s not more 50/50. It seems more like 95% of macos package manager mentions are homebrew.
I'm surprised that you're surprised. I use Macports but almost everything I encounter gives Homebrew install instructions up front (Macports is rarely mentioned, even if there is a port available).
Additionally, I find that while the docs for advanced Homebrew use are poor, they do at least have the basic everyday usage well-documented up-front. Macports approach of providing long, detailed & comprehensive contributor-oriented API docs and almost nothing simple & accessible for daily users makes it really intimidating for new users trialling it.
I would much rather just have Mac OS come without Python and set up pyenv myself.
What was it used for? CUPS? something else?
Useful when coding small demos:
php -S localhost:8000 python -m http.server 8000python3 -m http.server 8000
I would recommend installing PHP via brew https://github.com/shivammathur/homebrew-php
I know Linux often relies on python and perl scripts, so it makes sense to include them in the base system. But there's no reason to include them in the base system if they're not used.
It may seem convenient at first, but:
- updates are subject to the release schedule and priorities of the OS — which are unlikely to match yours are all your apps. - when you end up going your own way anyway, you have to fight the OS over how to manage tools that it’s also trying to manage.
Whether it’s PHP, Vulkan, or whatever, you do not want it strictly tied to the OS.
GPL has a lot of other considerations when mixed with proprietary code however which makes it a very unpragmatic choice for commercial software companies who may be bound by multiple licenses.
Guess it’s time to re-implement busybox in Rust with a non-viral license!
I agree that they keep something like python2 around for scripting, but that’s about it. Having to get around the included languages is a bitch every time I’m trying to set up a development environment.
The real bummer is for newcomers. It's going to make getting started much more of a headache since they first need to learn how to setup a local environment.
this, to me, is a non-issue. I certainly don't need my desktop system to ship a php binary when the language itself is a fast moving target these days.
You know what I'd rather Apple do? Ship proper control group and namespace support within XNU so it can be containerized. People have been asking for this for a while:
https://unix.stackexchange.com/questions/113471/cgroups-anal...
Do they still use CUPS for printing ???.
I never use the OSX standard version of PHP or Python
source?
Normally you try to keep a system as small as possible, especially regarding scripting languages, so an attacker has as little tools as possible available.
So since it's not used (in a webserver for example), it's not as much more a risk than shell scripts I guess.