impl writf for mac