Install SDL2 in mac

10,391
brew install SDL2

brew install SDL2_image

brew install SDL2_ttf
Share:
10,391
newbie
Author by

newbie

Updated on July 03, 2022

Comments

  • newbie
    newbie almost 2 years

    I am just getting started with learning OpenGL. I am struggling to setup my environment. This is what I did do far:

    • Downloaded SDL2 binary from https://www.libsdl.org/download-2.0.php for mac.
    • Copied SDL2.framework into ~/Library/Frameworks. This didn't work (copied my command bellow).
    • Then I tried to copy SDL2.framework into /System/Library/Frameworks. However I am not not being able to enable write permission there. It's my personal mac. I'm not sure whats going on. I tried to copy it with "sudo ~/Downloads/SDL* /System/Library/Framework" but it didn't work

    I am using following command to compile a simple opengl code:

    g++ test.cpp glad/glad.c -I/Library/Frameworks/SDL2.framework/Headers -F/Library/Frameworks -framework SDL2
    

    enter image description here

    Can someone please help me out ? Not sure what I'm missing.