Port crnlib to Mac