Installing SDL

From Mac Guides

Jump to: navigation, search

If you have tried to install or even use the SDL programming API on Mac OS X, you may find that it doesn't work. This article explains two ways to work around this.

Installing Xcode and SDL

Visit the Apple Developer Connection, create a developer account and download Xcode. Version 2.2 is 837.3MB and requires Mac OS X 10.4 (Tiger). Older versions should work as well, and you will most likely find a version included with your Mac OS X install disks.

Once you have Xcode installed, you can install SDL. Visit and download both SDL-devel and SDL packages. Install SDL first - the latest stable version is the best. After installing SDL, install SDL-devel. SDL-devel installs an Xcode project that you are able to use to create SDL applications.

Get SDL working

Remount, if you ejected, the SDL-x.x.x.dmg disk image and navigate to SDL.framework/Headers (use Show Package Contents in the Finder contextual menu to open the framework). You should see a bunch of files with SDL or begin or close as the prefix. When you create a project, copy all these to your project folder. For example, imagine a new project called Tetris. It makes a folder called Tetris and puts main.c inside. All the files in the Headers folder should then be copied to the project folder, where main.c is, and they can then be included in the project. You should now be able to create a new project choosing SDL Application as the project type and have everything work as long as you always copy those 28+ files to the root of your project folder.