I'm at my computer now and just checked, on the mac version the lines to select the version (lines 4 and 5 of main) are commented out. You may also need to change
glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE);
glutInitDisplayMode(GLUT_3_2_CORE_PROFILE | GLUT_RGBA | GLUT_DOUBLE);
a few lines before (https://stackoverflow.com/questions/11259328/glut-on-os-x-with-opengl-3-2-core-profile).
I don't have a mac to check but hopefully one or both of those changes should fix it.