Written 2021-02-18 on MacOS 11.2.1 BigSur and Xcode 12.4
Based on the instructions at https://www.sfml-dev.org/tutorials/2.5/start-osx.php:
- Download the SDK https://www.sfml-dev.org/download.php
- Copy contents of
- Copy contents of
~/Library/Developer/Xcode/Templates(create the folders if they don't exist yet)
Then, in Xcode, you can create new SFML apps.
Fix paths in build script
In Xcode, Click on the
.xcodeproj file and go to the
Build Phases tab. Expand
Run Script and update the paths to start with simply
/Library/Framework/ instead of
/Users/SFML/Desktop.... This will help resolve errors like this:
ditto: Cannot get the real path for source '/Users/SFML/Desktop/packaging/tmp/install/Library/Frameworks/sfml-system.framework' couldn't copy /Users/SFML/Desktop/packaging/tmp/install/Library/Frameworks/sfml-system.framework to /Users/dtron/Library/Developer/Xcode/DerivedData/Deleteme-acixjsmlqhawaehgseqymmiyrydx/Build/Products/Debug/Deleteme.app/Contents/Frameworks//sfml-system.framework
Allow unverified framework to be opened
When you try to run the new app created from template, it will then give you errors about not being able to load the framework because it is untrusted. You will see an error like this:
smfl-*.framework cannot be opened because the developer cannot be verified. macOS cannot verify that this app is free from malware. Safari downloaded this file today at 12:00 PM from www.sfml-dev.org.
You can resolve these one at a time by going to your
System Preferences | Security & Privacy | General and look for
Allow Anyway button next to the message saying
sfml-*.framework was blocked from use because it is not from an identified developer. The next time you run it will allow you to open it. You will have to repeat this for every framework.
Build the .app
To build for release go to
Product | Archive. To build for Debug run
Product | Build.
You might get an error about signing like this, but it will still finish building the .app:
CodeSign /Users/dtron/Library/Developer/Xcode/DerivedData/Deleteme-acixjsmlqhawaehgseqymmiyrydx/Build/Intermediates.noindex/ArchiveIntermediates/Deleteme/InstallationBuildProductsLocation/Applications/Deleteme.app (in target 'Deleteme' from project 'Deleteme') cd /Users/dtron/workspace/Deleteme export CODESIGN_ALLOCATE\=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/codesign_allocate Signing Identity: "-" /usr/bin/codesign --force --sign - --entitlements /Users/dtron/Library/Developer/Xcode/DerivedData/Deleteme-acixjsmlqhawaehgseqymmiyrydx/Build/Intermediates.noindex/ArchiveIntermediates/Deleteme/IntermediateBuildFilesPath/Deleteme.build/Release/Deleteme.build/Deleteme.app.xcent /Users/dtron/Library/Developer/Xcode/DerivedData/Deleteme-acixjsmlqhawaehgseqymmiyrydx/Build/Intermediates.noindex/ArchiveIntermediates/Deleteme/InstallationBuildProductsLocation/Applications/Deleteme.app /Users/dtron/Library/Developer/Xcode/DerivedData/Deleteme-acixjsmlqhawaehgseqymmiyrydx/Build/Intermediates.noindex/ArchiveIntermediates/Deleteme/InstallationBuildProductsLocation/Applications/Deleteme.app: code object is not signed at all In subcomponent: /Users/dtron/Library/Developer/Xcode/DerivedData/Deleteme-acixjsmlqhawaehgseqymmiyrydx/Build/Intermediates.noindex/ArchiveIntermediates/Deleteme/InstallationBuildProductsLocation/Applications/Deleteme.app/Contents/Frameworks/vorbisenc.framework Command CodeSign failed with a nonzero exit code
Find the built .app file
You might have to press
Command+Shift+. to show hidden files like Library in your home directory.