4 ms·
If you use brew or macports you can install the coreutils package and then you're good to go with gnu find. I also use MacOS and I have setup the gnu userland
by fooblat 6y ago
If you use brew or macports you can install the coreutils package and then you're good to go with gnu find.
I also use MacOS and I have setup the gnu userland on my local so it matches the linux environment on our servers and containers.
- gpanders 6y agoYou’re right that defaulting to the GNU coreutils is probably more convenient. However, NOT doing this is a good way to ensure that any scripts you write remain portable and don’t use GNU extensions. That’s the reason I stick with the default BSD coreutils on macOS.
- fooblat 6y ago> You’re right that defaulting to the GNU coreutils is probably more convenient. It's not about convenience. It is about having a development environment that matches the target runtime environment. You can run into nasty surprises when the default behavior of a tool in your dev environment is different than in your production environment. I've been writing shell scripts professionally for over 20 years and I have always taken this approach and it has served me well.
- saagarjha 6y agoYou could also try restricting yourself to POSIX shell.