is now LinkedIn Learning!

To access courses again, please join LinkedIn Learning

All the same content you know and love

Plus, personalized course recommendations tailored just for you

All the same access to your Lynda learning history and certifications

Try LinkedIn Learning for free
Questions? Visit our help center.
Skip navigation

Cleaning up the code: Making an app struct

Cleaning up the code: Making an app struct: Learning OpenGL
Cleaning up the code: Making an app struct: Learning OpenGL

Resume Transcript Auto-Scroll
Skill Level Intermediate
1h 45m
Show More Show Less

Q: Why am I getting errors saying I don’t have GLEW installed when I try to create the Xcode projects with Cmake?

A: Newer macs running OS X 10.9 Mavericks or later do not come with GLEW preinstalled. You may have it if you upgraded to Mavericks from a previous version of OS X, but it will not be on a new computer or a clean install of the operating system. As such, you’ll need to install a few things to get GLEW set up.

1) Download, Install, and Run Xcode

First, you’ll need to make sure Xcode is installed and fully loaded. You can download Xcode for free from the Mac App Store. Make sure you open Xcode at least once before proceeding, as it needs to authenticate your administrative privileges before it finishes installing all its components. If you fail to do this, you’ll receive errors in later steps.
2) Install Homebrew, to Help Install GLEW and CMake
Next, we’re going to install Homebrew, which will allow us to install GLEW and also CMake.
To find out if you have Homebrew installed, open the OS X Terminal and type:
which brew
If brew is installed, Terminal should return “/usr/local/bin/”. If it’s not found, then we’ll need to install it. To install brew, enter this command in terminal:
ruby -e "$(curl -fsSL"
Homebrew will install, and once it’s completed, you’ll see it prompt you to run brew doctor, which will test for any issues. To run brew doctor, simply type:
brew doctor
Once it has finished running you’ll see a list of potential warnings. It’s important to note that brew is very cautious, so you’ll likely get at least one or two warnings, but they may not be deal breakers or even cause any problems. Brew is designed to work in a wide variety of applications, most of which we will not be using.
3) Install GLEW
Now that we have brew setup, we’re going to install GLEW. To install GLEW, type:
brew install glew
Homebrew may recommend you run brew doctor before installing anything, and you should do so if you haven’t already. See step 2 for more information on brew doctor. At this point you can return to the video if you wish. The rest of the steps are also listed here for reference.
4) Install CMake to Build Project Files
CMake will allow us to build Xcode projects that work with GLEW. There are two ways to install CMake. To see if you have CMake installed, type:
which cmake
Terminal should return “/usr/local/bin/cmake/”.
If it doesn’t, you can download and unzip the UNIX/Linux source, a tar.gz file (filename cmake-3.0.0.tar.gz as of publish date) from
(Note: Do not download the binary distribution, as this makes it more difficult to access CMake from the command line.)
First, in Terminal navigate to your CMake folder, which you can do by typing “cd ” and then dragging the folder into Terminal. Next type:
./bootstrap && make && make install
CMake should install, and you should be ready to go! If this doesn’t work, you can also try using brew, though compiling from source is the preferred method. To use brew, from Terminal type:
brew install cmake
Brew should install CMake and you’ll be ready for the next step.
5) Build Xcode Project Files
Finally, once GLEW and CMake has finished installing, we need to build our Xcode project to test. (In the following commands where it says “Exercise Files”, this should be the location of the Exercise Files you downloaded from
cd Exercise Files
mkdir xcode
cd xcode
cmake -G "Xcode" ..
Once completed, there should be a project available in the “xcode” folder that was created.
If you prefer, you can also build individual projects for each C++ file at a time by running a command like this:
./ examples/Extensions.cpp

Skills covered in this course
Developer Games OpenGL

Continue Assessment

You started this assessment previously and didn't complete it. You can pick up where you left off, or start over.

Start My Free Month

Start your free month on LinkedIn Learning, which now features 100% of courses. Develop in-demand skills with access to thousands of expert-led courses on business, tech and creative topics.

Start My Free Month

You are now leaving and will be automatically redirected to LinkedIn Learning to access your learning content.