Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

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?

share|improve this question

1 Answer 1

up vote 7 down vote accepted

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.

share|improve this answer
4  
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. –  Scott Earle Jul 13 at 15:43

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.