diff --git a/src/libstore/build.cc b/src/libstore/build.cc
index 57263476573fee9d2c321ac9cb43d32f82c6390c..147093fae262c33376930b5364453a47138f3c96 100644
--- a/src/libstore/build.cc
+++ b/src/libstore/build.cc
@@ -2250,10 +2250,13 @@ void DerivationGoal::startBuilder()
 
         if (chown(slaveName.c_str(), buildUser->getUID(), 0))
             throw SysError("changing owner of pseudoterminal slave");
-    } else {
+    }
+#if __APPLE__
+    else {
         if (grantpt(builderOut.readSide.get()))
             throw SysError("granting access to pseudoterminal slave");
     }
+#endif
 
     #if 0
     // Mount the pt in the sandbox so that the "tty" command works.