Fix script path detection on macOS