port ios library to os x library