Does freetype comes pre-installed on Mac?

13,634

The dynamic linking library comes pre-installed, so you can use any software that requires freetype2 out of the box:

/usr/X11/lib/libfreetype.6.dylib

However, the actual headers and such required to build a freetype2 project do not ship with OS X. To get these, you need to install Xcode; when you install Xcode with any version of the OS X platform SDK, it comes with freetype2:

/Developer/SDKs/MacOSX10.6.sdk/usr/X11/include/freetype2/freetype/freetype.h

These days, I think you have to go through the App Store in order to download Xcode, but it is free and that is about all you need to get started developing GL / freetype2 software on OS X. I believe they stopped including Xcode on the OS X install DVDs with the release of 10.6, so registering as an Apple Developer or going through the App Store is probably your only option.


By the way, you are going to have to jump through some hoops when you start using OpenGL on OS X for the first time. It is a little different from most platforms, particularly when it comes to loading (or rather not loading) extensions at run-time. Apple implements the full feature set for OpenGL 2.1 / 3.2 core for all OS X 10.7+ systems even if the underlying GPU does not support it all - it has software fallbacks for anything not supported by hardware.

So you don't have to worry about loading extensions based on the installed GPU capabilities, but you do have to worry about whether using a feature will throw you onto a software path. You also have to put up with longer than average wait time for new versions of OpenGL to be implemented, but this is the price you pay for guaranteed feature set support I suppose.

I would suggest you use something like glfw or SDL2 when starting out, especially if you don't like Objective C (does anyone, honestly?). A lot of newer OpenGL context management these days needs to be done using Objective C (cocoa); Apple is not a big fan of their own C APIs (carbon). glfw and SDL2 hide all this stuff from you so you never have to write a single piece of ugly Objective C code if you do not want :)

Share:
13,634
2am
Author by

2am

OpenGL Developer

Updated on June 19, 2022

Comments

  • 2am
    2am almost 2 years

    I am relatively new to Mac OS X environment. I was trying to install freetype library to display text in OpenGL, but I failed. I read on some forum that freetype comes pre-installed with Mac OS X mountain lion. I just wanted to confirm this. If it does in fact comes with Mac then how can I include it in my project? If it doesn't comes with Mac then what is the ideal set of step one would follow to install freetype in Mac?

  • 2am
    2am over 10 years
    Much appreciated. I am trying to run a project on Mac, which is already functional on windows. I got it up and running using Carbon, the program works fine, but no text is visible in the Mac version. So thought of using freetype2, which has an added advantage of Anti-aliasing. I am trying to locate the freetype.h header file now.
  • Andon M. Coleman
    Andon M. Coleman over 10 years
    @2am: Ah hah, that is why I included the path in my answer. When you install Xcode, it (usually) puts the platform SDK it ships with in /Developer/SDKs/MacOSX10.n.sdk/. Development frameworks will also show up relative to this path. Interesting side note, these days to get platform SDKs for older versions of OS X you often have to download an older version of Xcode - it used to be really simple on the Apple developer site to download an arbitrary SDK version :-\
  • 2am
    2am over 10 years
    In Mountain lion the directory where freetype comes preinstalled is..< /Developer/SDKs/MacOSX10.7.sdk/usr/X11/include/freetype2/fre‌​etype