Being a Bad POSIX Citizen

Featured image for sharing metadata for article

I've just been listening to the Syscast episode The differences between Linux and BSD, which was really interesting. I'm a GNU/Linux user in my personal life, and in my professional life at Capital One, I use Mac OSX and deploy onto Linux-based AWS EC2, but I have never used a "real" BSD on the server, or for general purpose computing.

Anna has recently got a new job in which she's going to be working on Mac, so I shared some of my top tips for getting used to it compared to Linux, and a few things to help with productivity that I've found useful. One of those points was to ignore the BSD coreutils, and instead use the GNU ones - i.e. use the GNU ls over the one that's installed on Mac by default.

Before I first started to use Mac, I'd heard of making scripts compliant with POSIX, so they were more portable. However, I'd not really got around to properly trying it aside from what ShellCheck told me off for. But it wasn't until I started using it that I found it very frustrating to be swapping between the two flavours of tools, and having to find a middle ground which wasn't nearly as powerful.

The end result was that I decided to install the GNU versions of the tools, because I couldn't be bothered with trying to compromise / write platform-dependent scripts, and it was a straightforward fix.

It's a shame really, because I really should've stuck at it and learned how to write scripts with a different toolchain, and to bolster my experience and knowledge, instead of taking the easy way out.

But that being said, I'm not really sure I will aim to correct this - I'm trying to avoid shell scripts where possible, and instead replacing them with a scripting language like Ruby, which I personally find better to read and write. But I will make sure colleagues are aware that the shell scripts I write are built to be run with GNU tools, lest they find issues running them.

Written by Jamie Tanna's profile image Jamie Tanna on , and last updated on .

Content for this article is shared under the terms of the Creative Commons Attribution Non Commercial Share Alike 4.0 International, and code is shared under the Apache License 2.0.

#linux #posix #bsd #mac.

This post was filed under articles.

Interactions with this post

Interactions with this post

Below you can find the interactions that this page has had using WebMention.

Have you written a response to this post? Let me know the URL:

Do you not have a website set up with WebMention capabilities? You can use Comment Parade.