Issues using SDL2 on Xcode on macOS

Hey guys, I’ve been having this issue with my SDL2 install and its been driving me crazy, I’ve asked around everywhere but no one can fix my issue for some reason, so I thought I’d come here. So, I’ve been trying to follow lazy foo’s tutorial and his first step isn’t working. I’m developing on both Intel and Apple Silicon computers and every time I install the framework to the /Library/Framework folder, I can’t seem to use it. Whenever I use “#include<SDL2/SDL.h>” the path autocompletes but when I try building, it says the file cannot be found. I have included the framework into the project and tried both the dev and runtime frameworks and neither work.

I then moved onto building the libraries myself following the instructions on the site but every time I run make, a bunch of alias files are created but when I tell macOS to show e the actual files, it says they cannot be found. So right now, I’m stuck, I don’t know what else to try and its really beginning to frustrate me. I feel like I’m just going round in circles. I’m currently on macOS Monterey and Xcode 13. Has anyone else had this issue or can anyone else fix it?

These are the steps I follow:

Put SDL2.framework in the same folder as YourProject.xcodeproj (don’t put it in /Library/Frameworks). Don’t use the command line to copy it, as in my experience it doesn’t preserve the internal symlinks.

In Xcode, in your project’s settings, select your project’s target. In the General tab, in the Frameworks, Libraries, and Embedded Content section, click the + to add another framework. Click Add OtherAdd Files and select SDL2.framework. This will make Xcode link your app against the SDL2 framework, and also tell Xcode to put it inside your app bundle so your users won’t have to have SDL installed.

In the Xcode project settings, in the Build Settings tab, find the Framework Search Paths setting. Make sure $(PROJECT_DIR) is included. Apparently this is automatically done on the latest Xcode, but still make sure to check because it didn’t use to be.

In the project settings Signing & Capabilities tab, scroll down and tick the box that says Disable Library Validation unless the SDL2.framework you’re using was built and signed by you. This will keep macOS from refusing to run your app (because your app is signed by you, but the framework is signed by someone else).

edit: Also, if you’re going to build SDL yourself for macOS or iOS, use the Xcode project that comes with the SDL sourcecode instead of messing around with make etc.