
Does program written with Posix compile both on Linux and macOS? - tosieuda
Also if macOS is POSIX certified why it is not easy to port macOS programs and libraries to Linux and reverse?
======
wahern
IIRC I've found it extremely easy to support both macOS and Linux (as well as
the *BSDs, and to a large extent Solaris and AIX), even when using non-POSIX,
extension interfaces like epoll and kqueue.

However, I do mostly systems and network programming. When you get into GUI
apps there's no avoiding the immense differences between some APIs. Learning
how to identify and carefully separate program components that can be
reasonably kept portable is something you learn with experience. And
experience only comes with practice.

Also, I learned long ago that "porting" an application is typically a losing
battle. If a program is not written with portability in mind from day 1,
subsequent porting efforts will be so costly that you'll either abandon it
altogether or conclude that portability is inherently costly and avoid it in
the future.

------
wmf
If a program uses only POSIX APIs then it should compile on Linux and macOS
with minimal tweaking. But real apps use a lot of APIs that aren't included in
POSIX, like Cocoa.

