Building GLFW for older OSX versions


I’m updated GLFW because I was missing a few features, and now when I compile my project I get a list of warnings:

ld: warning: object file (libs/osx_64/libglfw3.a(window.c.o)) was built for newer OSXersion (10.12) than being linked (10.8)
ld: warning: object file (libs/osx_64/libglfw3.a(input.c.o)) was built for newer OSX version (10.12) than being linked (10.8)

I know I have to build GLFW to target OSX 10.8 (similar to how I use -mmacosx-version-min=10.8 in my Makefile) and I think I’ve done it before but I’m currently at a loss.

How can I set my minimum OSX version when compiling GLFW? Sorry about the dumb question, any help is really appreciated.


You can do that with CMake by passing -DCMAKE_OSX_DEPLOYMENT_TARGET=10.8 on command-line or by specifying setting MACOSX_DEPLOYMENT_TARGET=10.8 environment variable. More info here:


Thank you! I had seen that variable but ran into some errors and was unsure if I was doing something wrong, got it now. Steps for anyone reading this in future:

What I had to do was download and uncompress the Mac OSX 10.8 SDK. Found a handy list of them here:

Then when calling cmake I set my OSX deployment target and the path to the SDK:

Then simply call make, grab the headers from the include folder and libglfw3.a from the src folder and you’re good to go.


I’m pretty sure you don’t need older SDK version. Just specifying DEPLOYMENT_TARGET should be enough. I am doing this for my project that depends on Qt. I build everything with just that deployment target variable set on OSX 10.12 with latest Xcode, and people can successfully run my software on even on 10.8.


Hmmm I tried:

by itself and I got an error that sysroot was missing. However it works now? Almost as if specifying the SDK is a one-time thing. I would have thought it should work out of the box like you said.