Changes to run in Mac OSX

some shell commands does not work on OS X, updated to function, making the validation of OS

```
"$OSTYPE" == "darwin"*
```