The ??? that works for me is "ls -a | grep -i -E '%s' | xargs ls -d". However that wouldn't fix the but that -d \\n attempts to fix. I'll look for a proper fix, posix complaint, and send it later (this week hopefully?).
One thing I should clarify, the problem is not exclusive to OSX (darwin) but basically all OSs that don't ship gnu coreutils or GNU xargs. So the fix would be (eq system-type 'linux) most likely. For example OpenBSD's xargs doesn't take -d nor its ls take --group-directories-first option.
So looking into counsel it already has a posix compliant alternative in its codebase U_U'. But it is disabled by default. To make ivy-occur work for counsel-find-file one has to set counsel-find-file-occur-use-find to t. One way to handle this something like:
(defvarcounsel-find-file-occur-use-find (when (eq system-type 'gnu/linux)
"When non-nil, `counsel-find-file-occur' will use \"find\" as the base cmd.")