added compatibility for Darwin

Added additional regex and if for splitting linux and darwin.