--- pty.c.orig
+++ pty.c
@@ -30,6 +30,9 @@
 #include <sys/stat.h>
 #include <fcntl.h>
 #include <signal.h>
+#ifdef __APPLE__
+#include <util.h>
+#endif
 
 #include "config.h"
 #include "screen.h"
--- screen.c.orig
+++ screen.c
@@ -47,6 +47,9 @@
 #include <string.h>
 #include <unistd.h>
 #include <fcntl.h>
+#ifdef __APPLE__
+#include <err.h>
+#endif
 
 #if defined(__sun)
 # include <limits.h>
--- socket.c.orig
+++ socket.c
@@ -1419,7 +1419,9 @@
   char *p;
   int pid;
   int noshowwin;
+#ifdef UTMPOK
   struct win *wi;
+#endif
 
   ASSERT(display);
   pid = D_userpid;
