moodle-docker icon indicating copy to clipboard operation
moodle-docker copied to clipboard

[Mac] Unsupported grep flags used in `MOODLE_DOCKER_APP_RUNTIME` inference

Open NoelDeMartin opened this issue 4 years ago • 3 comments

The script implemented to guess the MOODLE_DOCKER_APP_RUNTIME env variable is using some flags that are not supported in Mac. It can be confusing because no error is thrown, instead the following message appears when running moodle-docker-compose:

$ bin/moodle-docker-compose exec webserver php admin/tool/behat/cli/init.php
usage: grep [-abcDEFGHhIiJLlmnOoqRSsUVvwxZ] [-A num] [-B num] [-C[num]]
  [-e pattern] [-f file] [--binary-files=value] [--color=when]
  [--context[=num]] [--directories=action] [--label] [--line-buffered]
  [--null] [pattern] [file ...]

The workaround for now is just to explicitly initialize the MOODLE_DOCKER_APP_RUNTIME variable in your local environment.

NoelDeMartin avatar Oct 07 '21 08:10 NoelDeMartin

I noticed this too. It looks like the -P (--perl-regexp) flag is not supported by grep on MacOS. This is used in several places in the bin/moodle-docker-compose file.

michael-milette avatar Nov 04 '22 14:11 michael-milette

Thanks for suggesting the workaround @NoelDeMartin

michael-milette avatar Nov 04 '22 14:11 michael-milette

Side note, I'd suggest to install GNU grep (and others, surely). That can be done both with:

  • homebrew: https://formulae.brew.sh/formula/grep
  • macports: https://ports.macports.org/port/grep/

Just in case you're already using any of them.

Ciao :-)

stronk7 avatar Nov 04 '22 21:11 stronk7