I have bash script that works on Ubuntu but for OS X 10.9 i get the error for split command:

split -b 1000000 -a 3 -d $F $F && rm $F || { echo "Error: 'split' command not installed" ; exit 1 ; }

split: illegal option -- d .

According to the split man page, -d is

   -d, --numeric-suffixes
          use numeric suffixes instead of alphabetic

Is there workaround for this?


1 Answer 1


The GNU version of split is different to the OS X version of split.

OS X is based on BSD Unix, and Linux (often referred to as GNU/Linux) uses the GNU toolset.

The GNU version of split is part of the coreutils, and the good news is that these are available in MacPorts. If you have MacPorts installed, you can install the coreutils port using the command:

sudo port install coreutils

This installs the GNU core utilities (including split) with a g prefix, so you call split using the command gsplit.

  • 5
    While I know it is possible to install the coreutils with the default names, I would never recommend it since all scripts written for OS X assume that the BSD tools have the 'original' names. Commented Jul 13, 2014 at 15:43
  • 11
    The coreutils are also available via homebrew (also with a 'g' prefix): brew install coreutils Commented Mar 11, 2015 at 17:10
  • @ScottEarle well you shouldn't write bash for OSX. Regardless you can get around that by using an alternate shell on iTerm and loading a separate bash_aliases file, leaving the system one alone
    – Ray Foss
    Commented Mar 27, 2018 at 22:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .