Today I am going to show how you can run OpenGL programs on your Mac OS X through command line (Terminal.App).

1. Use the header file “GLUT/glut.h” and not “GL/glut.h”

2. main function should return an integer type value.

int main(int argc, char** argv) {
    return 0;

3. Run the program by using the following command:

gcc -framework OpenGL -framework GLUT <inputfile> -o <output> -Wno-deprecated

We are passing -Wno-deprecated flag to surpress the warning generated as lot of procedures are deprecated after 10.9.x.

In Ubuntu, we pass -lm -lglut -lGL -lGLUT, but in our case we pass OpenGL and GLUT as parameters to framework option.

Happy animating.

Let the Windows be open, and feel the Freedom.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s