1diff -ur a/exp_win.c b/exp_win.c
2--- a/exp_win.c 2018-02-02 14:15:52.000000000 -0500
3+++ b/exp_win.c 2023-10-10 07:47:33.082690432 -0400
4@@ -39,7 +39,8 @@
5 /* Sigh. On AIX 2.3, termios.h exists but does not define TIOCGWINSZ */
6 /* Instead, it has to come from ioctl.h. However, As I said above, this */
7 /* can't be cavalierly included on all machines, even when it exists. */
8-#if defined(HAVE_TERMIOS) && !defined(HAVE_TIOCGWINSZ_IN_TERMIOS_H)
9+/* Darwin also has termios.h, but it requires ioctl.h for `ioctl`. */
10+#if defined(HAVE_TERMIOS) && (defined(__APPLE__) || !defined(HAVE_TIOCGWINSZ_IN_TERMIOS_H))
11 # include <sys/ioctl.h>
12 #endif
13
14diff -ur d/pty_termios.c c/pty_termios.c
15--- d/pty_termios.c 2023-10-10 07:59:23.244452442 -0400
16+++ c/pty_termios.c 2023-10-10 08:00:35.303231582 -0400
17@@ -7,7 +7,13 @@
18
19 */
20
21-#include <pty.h> /* openpty */
22+/* openpty */
23+#ifdef __APPLE__
24+#include <util.h>
25+#else /* pty.h is Linux-specific */
26+#include <pty.h>
27+#endif
28+
29 #include <stdio.h>
30 #include <signal.h>
31