Installing GLEW in Mac OS X (Leopard)

Print

I’ve been trying for a while to get GLEW (The OpenGL Extension Wrangler Library) working and finally I did it. I think this could be useful for other people. First let me define the platform this way:

  • MacBook (2GHz Intel Core 2 Duo)
  • Mac Os 10.5 (Leopard)
  • Xcode version 3.0
  • glew 1.4.0

Download the last source files of GLEW (at this moment 1.4.0), be sure to downolad the .tgz file. Don’t try either the compiled or the .zip version of the files, there are some issues with them and apparently the .tgz file is the only one that works (read the newsgroup of GLEW in sourceforge for more information about this).

1. Unziping and untaring the file:

tar zxvf glew-1.4.0-src.tgz

2. Compile the sources from a terminal window:

make

There are some harmless warnings that don’t affect the compilation. Watch for errors, however I didn’t have a single one.

3. Install the binaries (you need superuser permissions):

sudo -s

make install

make clean

The files are copied to /usr/lib and /usr/include/GL.

3. Open Xcode

4. Create a new project (The C++ Tool template is perfect)

5. Right-click on the name of the project and choose Add > existing frameworks…

6. Add to your project GLUT.framework. Also, add the following files and select the option of ‘including the file if necessary’ in the popping-up dialog:

/usr/lib/libGLEW.a and /usr/include/GL/glew.h

7. Include the following lines in your code (e.g., main.cpp):

#include <glew.h>
#include <GLUT/glut.h>

8. Go to Project > Edit Project settings. In the pop-up window:

a) Select in Configuration tab: All configurations
b) Select in Architectures tab: i386 (you might need to change this according to your machine).

c) In Valid Architectures, delete all the existing architectures and leave only i386.
d) In ‘Other Linker Flags’ add this line:
-framework OpenGL -framework GLUT

That’s all. After that you can close the panel, and build, or ‘build and go’ your project and it should work.

I found these links somewhat useful :

http://www.vis.uky.edu/~dnister/Teaching/CS535/macNotes.html

http://www.idevapps.com/forum/showthread.php?t=5951

Print

5 thoughts on “Installing GLEW in Mac OS X (Leopard)


  1. Tried this tutorial on the newest version of GLEW, 1.7.0. But it doesn’t see like it is able to create a framework.

    I follow your tutorial and it seems like everything is working.

    Have you tried this with any of the later versions?


  2. how to add /usr/lib/libGLEW.a and /usr/include/GL/glew.h into my project in Xcode in step 6? usr/ folder is hided by xcode, can’t open it


  3. I see. Show hidden files in Finder and then drag it into my project did the job. Thanks anyway.

Leave a Reply

Your email address will not be published. Required fields are marked *


− 6 = zero

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>