OS X compatibility fixes

  * -i option on OSX version of sed requires an argument
  * correctly set PLAT=macosx if Darwin is detected