https://bugs.gentoo.org/953896 pty.h is necessary on some Linux, but it isn't in POSIX, so it breaks systems like macOS, *BSD, HPUX, AIX and Solaris. Basically everywhere not-Linux, so add guard to only apply on Linux. --- a/pty.c +++ b/pty.c @@ -29,6 +29,9 @@ #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> +#if defined(__linux__) || defined(__linux) || defined(linux) +#include <pty.h> +#endif #include <signal.h> #if defined(__OpenBSD__)