moodlehq / moodle-docker

A docker environment for moodle developers
GNU General Public License v3.0
376 stars 245 forks source link

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

Closed NoelDeMartin closed 4 months ago

NoelDeMartin commented 2 years ago

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.

michael-milette commented 1 year ago

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 commented 1 year ago

Thanks for suggesting the workaround @NoelDeMartin

stronk7 commented 1 year ago

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

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

Ciao :-)