I want to make my bash script deal with long parameters. I found getopt
, but it isn\'t supported in OS X. Can anyone tell me why getopt
was implemented
There is a brew bottle for getopt.
Just run brew install gnu-getopt
.
You can either specify the path for it like
/usr/local/Cellar/gnu-getopt/1.1.6/bin/getopt
Or use brew link --force gnu-getopt
so it will be linked in /usr/local/bin/
Just be aware that forcing linking might be corrupting your system (as it replaces the system getopt by the gnu one).
See also other answer suggesting to define FLAGS_GETOPT_CMD
.