I follow the book \"OpenGL SuperBible 5th Edition\" to study openGL, the capture 6th demo to create shader by hand all not work. Like the demo of \"ShadedTriangle\", to create
macOS' system GLUT does not have the capability of creating an OpenGL 3+ context.
FreeGLUT provides a way to do it, taken from here:
glutInitContextVersion(3,2); /* or later versions, core was introduced only with 3.2 */
glutInitContextProfile(GLUT_CORE_PROFILE);
Or you can take @izzy's advice and use GLFW.