Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Installing & Using SFML on Mac OS X for the complete PC idiot  (Read 3905 times)

0 Members and 1 Guest are viewing this topic.


  • Newbie
  • *
  • Posts: 8
    • View Profile
    • Email
Installing & Using SFML on Mac OS X for the complete PC idiot
« on: January 23, 2016, 05:36:23 pm »
I recently got a MacBook Air (Yosemite), and decided to convert some projects I’d written using SFML from my PC to the Mac.  This turned out to be such an ordeal, I wrote this synopsis of the problems I had to help anyone else with similar unfamiliarity with Mac OS X, and to raise some questions about using SFML on the Mac OS X system. 
No problems installing Xcode (7.1) with Clang or the Command Line Tools following the SFML tutorial, or installing SFML frameworks (2.3).  However, the instructions for installing SFML dylibs starts with “Copy the content of lib to /usr/local/lib and copy the content of include to /usr/local/include.”  I didn’t realize that the /usr/local/ folders are hidden (seems this info should be included in the instructions), so I was unclear what to do.  I initially installed them in folders I made in /Library/, and the fact that Xcode was able to successfully run the Hello SFML demo shows that if frameworks is properly installed and specified for the build, Xcode doesn’t need dylibs for SFML projects.  I later learned how to show hidden files (http://www.macworld.co.uk/how-to/mac-software/how-show-hidden-files-in-mac-os-x-finder-3520878/).  I’ve now installed dylibs properly, although include didn’t exist in usr/local/, so I had to make the folder. I can now compile apps with either dylibs or frameworks. I had assumed that dylibs would build smaller apps with fewer unnecessary files, but I don’t see a big difference in app sizes built with either dylibs or frameworks, and some frameworks are present in the apps built with dylibs. A good tutorial on how and why to set up SFML Xcode projects with frameworks vs. dylibs would be useful.
The first game project worked immediately, but the second compiled and ran without errors when building with Xcode, but when the app was copied onto the desktop and run, the game high score text file would never update.  Turns out I’d forgotten to include resourcePath() in the path for writing to the data text file, but trying to debug that turned into a major project of its own, since the program worked perfectly when using Xcode but failed when run as a separate app. I knew the data text file was in the app, because I could see it when I looked at it on my PC, but couldn’t see anything on the Mac. I found a website that recommended right-clicking the mouse to show app contents on the Mac, but of course, there is no right click on the touch pad of a MacBook Air.  Quite by accident, I found that hovering over the app icon and clicking with two fingers is the equivalent of a right mouse click, and then the finder prompts you to show the package contents. However, having to separately click on each app to see the app content files seems like a serious defect in the finder.  If there’s a shortcut I’m missing that allows you to search for all copies of a named file in all apps as well as on the main drive file structure, I’d very much appreciate hearing about it.  Once I could see the app contents in the finder, it was possible to launch the app using a terminal located in the app’s MacOS folder that allowed easier debugging when running the app independently of Xcode.
I hope others find this useful, and look forward to hearing about why one should use SFML dylibs vs. frameworks on Mac OS X.