Jordan Savant # Software Engineer

SFML 2 Mac OS X Development

How to install and get SFML development working on Mac OS X. This version uses an OS X Mavericks operating system and the SFML 2.1 installation guide: "SFML and Xcode (Mac OS X"

Set Up Xcode 5

  1. Ensure your OS is up to date.
  2. Install Xcode 5 from the app store. Xcode will come bundled with the Command Line Tools necessary to compile SFML applications.
  3. Create a project folder to store the SFML Distribution files, your source code and any published app.
  4. Download the Clang Universal SFML packages located here ("Download SFML 2.1") to your project directory.
  5. Unarchive the download which should unpack into like: SFML-2.1-osz-clang-universal/
  6. Copy the contents of the unpacked Frameworks/ directory to /Library/Frameworks/
  7. Copy the SFML dependencies sndfile.framework and freetype.framework from extlibs/ to /Library/Frameworks/
  8. Download the Xcode 5 Templates located here ("Download SFML 2.1") to your project directory.
  9. Unarchive the download which should unpack into something like: xcode/templates/
  10. Open a terminal and run the install script located within xcode/templates/ or copy the SFML folder to /Library/Developer/Xcode/Templates/
sudo ./

Create Xcode Project

  1. Open Xcode.
  2. Create the SFML App through File > New > Project.
  3. Select SFML under OS X and choose the "SFML App" template.
  4. Fill out the application options area as shown:
  5. Click "Next" and choose the project folder create before. The project will now be setup and ready to run as a standalone .app
  6. The template will generate a main.cpp file and starting resources, and an OS X resource path function.
    • ResourcePath.hpp and are OS X specific functionality
    • has Objective C++ code Xcode will compile
    • You must re-implement the resourcePath() function on each operating system to access the content folder you store resources in.
  7. Your project folder will look like:
    • project/
      • SFML-2.1-osz-clang-universal/
      • xcode/
      • SFMLApp/
        • SMLFApp/
          • source files and resources...
        • SFMLApp.xcodeproj
  8. Click on the project in Xcode > Build Phases > Link Binary With Libraries and add OpenGL.Framework if you intend to do any custom Open GL coding.

Running and Publishing

  1. Run your project to verify that it works.
  2. To publish the .app go to Product > Archive > Distribute > Export As > Application

Adding Source to Xcode

Groups are required for the linker to work. Folders don't work. Its easiest to delete all the old source groups from the project and drag from Finder them back in, choosing to make groups.