Corrected commands for OSX

Corrected sed and mktemp uses for OSX.