Monthly Archives: July 2015

Symbolic Linking for Cocos

I’ve read loads of times about being able to have one version of cocos2d-x installed for all my projects – but never really followed up – but cocos is so big, having several versions really is a pain, so I decided to do it.
And it is easy!

I have an existing project at


Inside this project I have the cocos2d folder, containing all the cocos2d stuff, and all the other folders like Classes, Resources and all the folders.

First things first, I grab the latest and greatest version of cocos2d and put it in my Projects folder, in a folder called cocos2d-x-3.7.

In my case, this is what I did to get the latest (you can just download the zip if you want – I just did this bit in case I want to make changes and submit them back to cocos2d-x)

$ git clone git://
$ cd cocos2d-x
$ git checkout v3
$ ./
$ git submodule update --init

Now I go to my game project folder, and delete the cocos2d folder! Ok – so I really just copied it somewhere just in case – but you can delete it safely – after all you can always download it again!

So now I need to create a symbolic link from my project folder, pointing to the cocos2d-x-3.7 folder.

ln -s /Users/PooperPig/Documents/Projects/cocos2d-x-3.7 cocos2d

That’s really it! I can open up my project in XCode and run it just like normal!

The obvious question now is “What do I do when I want to upgrade the version of Cocos2d-x?”

Easy peasy.

Once you have created your new cocos2d-x-3.n directory, change to the project directory and use

ln -nfs /Users/PooperPig/Documents/Projects/cocos2d-x-3.8 cocos2d

this command simply replaces the current symbolic link with a new one.

Now you can test your project – and if it doesn’t work, you can use the ln -nfs again to point it back to old version!