diff --git gschem/src/x_controlfd.c gschem/src/x_controlfd.c
index 5786b3b..6375fe7 100644
--- gschem/src/x_controlfd.c
+++ gschem/src/x_controlfd.c
@@ -35,6 +35,19 @@
 
 #include <glib-unix.h>
 
+#ifdef __APPLE__
+/* As of Sierra, Mac OS X, macOS does not provide strchrnul()  */
+/* Find the first occurrence of C in S or the final NUL byte.  */
+static char *
+strchrnul (const char *s, int c_in)
+{
+  char c = c_in;
+  while (*s && (*s != c))
+    s++;
+  return (char *) s;
+}
+#endif
+
 static const char *help_string =
   "The following commands are supported:\n"
   "\n"
