diff --git a/src/runtime/opengl/opengl_common.h b/src/runtime/opengl/opengl_common.h
index 661c987e4b3c509de9712980d685cf59f3b5ffaa..0d247edfade4690026ce73282dc9e99b2b0c6858 100644
--- a/src/runtime/opengl/opengl_common.h
+++ b/src/runtime/opengl/opengl_common.h
@@ -11,7 +11,9 @@
 #include <tvm/runtime/packed_func.h>
 #include <tvm/runtime/device_api.h>
 #include <dmlc/logging.h>
-#include <GL/gl.h>
+#if defined(__APPLE__)
+#define GLFW_INCLUDE_GLCOREARB
+#endif
 #include <GLFW/glfw3.h>
 #include <string>
 #include <tuple>
diff --git a/src/runtime/opengl/opengl_device_api.cc b/src/runtime/opengl/opengl_device_api.cc
index df2947db625569afa556f1f1ad7580612f555f73..5f629fcf1a1f65a58a20d9126a4d3564fb46e79f 100644
--- a/src/runtime/opengl/opengl_device_api.cc
+++ b/src/runtime/opengl/opengl_device_api.cc
@@ -27,10 +27,12 @@ static const char* GLGetErrorString(GLenum error) {
       return "GL_INVALID_VALUE";
     case GL_INVALID_OPERATION:
       return "GL_INVALID_OPERATION";
+#if !defined(__APPLE__)
     case GL_STACK_OVERFLOW:
       return "GL_STACK_OVERFLOW";
     case GL_STACK_UNDERFLOW:
       return "GL_STACK_UNDERFLOW";
+#endif
     case GL_OUT_OF_MEMORY:
       return "GL_OUT_OF_MEMORY";
     default: