The Allegro Wiki is migrating to github at

OSX, Xcode 5, dylib

From Allegro Wiki
Jump to: navigation, search

Compiling Allegro and creating the Allegro dylib

Hopefully pre-compiled and ready to use Allegro dylib can be downloaded soon, then you can skip this step of getting the Allegro sources and compiling them yourself.

For now you roughly will have to run the following commands from the Terminal. And additionally get a lot of dependencies for the addons.

git clone
cd allegro

At this point, you must decide whether to use the allegro 5.0 or 5.1 dylibs. (NOTE: The rest of this guide assumes you are using 5.0 you will need to adapt some parts of this guide if you are staying with 5.1) For Allegro-5.0 dylibs, use the following terminal command:

git checkout 5.0

5.1 is the default install, so you can skip that step if you wish.

mkdir build
cd build

Now type

cmake -G Xcode - ..
sudo xcodebuild install
sudo xcodebuild -target install

now you need to open Xcode go to Mac OS X >Application >Command line tool make sure the language is c++ and create the project Now click on the project go to Build phases and expand link binary ... click on the + icon and navigate to /usr/local/lib/ here you will find all the allegro libraries Now go to Build settings and search for "Other flags " and for other c flags add this


NOTE: it should add one for C++ as well if no add the same for other c++ flags

And to finish off you need to go to Build Settings and search for Library Search Paths and add

and you are good to go now type this code to make sure it works

#include <iostream>
#include <allegro5/allegro.h>

int main(int argc, char **argv) {
    al_create_display(640, 480);
    al_clear_to_color(al_map_rgb_f(1, 1, 0));
    return 0;