Best Method to Set ENV_PATH Variable for Multiple Computers and Scripts?

This won't work on Mojave and before, because the ancient version of sed on those systems won't allow the newline metacharacter.

gsed manages that perfectly well, although that has to be installed by the user.

Here's a fix to use with older versions of “Apple” sed:

echo $PATH | sed $'s/:/\\\n/g'

I do not know for certain this will work on versions of macOS later than Mojave, but I would think so due to the nature of the C string.

-Chris

1 Like