Question about `platforms` and `${os.platform}`

Joshua Root jmr at
Sun Dec 12 08:02:47 UTC 2021

On 2021-12-12 11:54 , Jason Liu wrote:
> On Sat, Dec 11, 2021 at 6:41 PM Chris Jones <jonesc at 
> <mailto:jonesc at>> wrote:
>     No, because that would render the port non functional on non darwin
>     OSes. You should only specify the darwin platform when it is
>     actually required, e.g. when then making a os.major conditional that
>     inly makes sense in darwin platforms.
> Wait a minute, didn't Ryan say that "We don't really expect many ports 
> to be installable on other operating systems or for maintainers to test 
> anything on other operating systems"? So we /should/ worry about the 
> port being non-functional on non-Darwin OSes? I'm confused now....

Ports need to be "functional" on non-darwin platforms to the extent that 
things like portindex, 'port mirror', and 'port info' work. They don't 
need to be actually installable.

> That's why I originally thought that `platforms darwin` implied that the 
> portfile was only intended to be valid on Darwin. Now that I've learned 
> that `platforms darwin` doesn't actually do anything, I'm just... confused.

It means the port is expected to only be installable on darwin. Ports 
need to be more or less "valid" anywhere. The platforms option "doesn't 
actually do anything" in precisely the same way that statement is true 
for the description, i.e. what it does is simply make that information 
known to users.

- Josh

More information about the macports-dev mailing list