Refactor unix/mac detection to be more readable