pdfgrep works in development environment, fails when called from different process
I had been using pdfgrep successfully in Bash shell scripts in macOS up to 10.11.6. After upgrading to 10.13.6, those shell scripts still work in my development & testing environment (I use CodeRunner). But they now fail when called from the automation app Hazel (watches for changes in the file system and triggers actions like running shell scripts).
E.g. the script contains a line like if /usr/local/bin/pdfgrep -P "$strSuchmuster" "$s_uebergebener_Dateiname"; then
executes correctly in CodeRunner, but fails with the following log entry when called from Hazel:
libc++abi.dylib: terminating with uncaught exception of type std::runtime_error: collate_byname<char>::collate_byname failed to construct for
Suchmuster aus Liste: (?is)\bISSN\b.+Impressum
/Users/stefan/bin/bestimmen Dokumenttyp PDF-Datei.sh: line 257: 51332 Abort trap: 6 /usr/local/bin/pdfgrep -P "$strSuchmuster" "$s_uebergebener_Dateiname"
The pdfgrep version was installed through Homebrew, which has version 2.1.1. To test, I deleted the brew version and built pdfgrep 2.1.2 from source, but the error still persists.
As I use a lot of external commands installed through Homebrew in my shell scripts, I searched the log file for other commands now throwing errors, but pdfgrep seems to be the only one.