I recently needed to port the following line of networking code in Ceph to OS X (Ceph is developed almost exclusively on Linux). The MSGMORE flag is an optimization used to inform the networking layer that more data is going to be sent shortly. The MSGNOSIGNAL flag is used to block SIGPIPE. Unfortunately both of these macros are not defined on OS X.
First, since the MSGMORE flag is an optimization, we can turn it off if it isn't available (note that while reading about MSGMORE, it seems that a solution based on TCP_CORK may be possible, but that is for another time).
As for MSGNOSIGNAL, luckily OS X has a mechanism for blocking SIGPIPE, but not nearly as convenient. First, we need to detect when MSGNOSIGNAL is not defined, and provide a compatibility macro definition that won't affect the bitmask flags.
Finally, we can use the SONOSIGPIPE socket option to block SIGPIPE when MSGNOSIGNAL is not defined. The socket option can be set right after the socket is initially opened.