1: first, install the xcode development environment.
(If you have not installed the xcode development environment, you can download it from the appstore. It is very convenient [you only need to register it to download it for free, and the latest version is xcode4.5 ])
2: The cocos2d open source library is as follows:
Http://code.google.com/p/cocos2d-iphone/downloads/list
The latest beta (cocos2d-iphone-2.1-beta2.tar.gz)
3: After the download is complete, decompress the package and execute the cocos2d template installation script on the terminal.
The procedure is as follows:
1. decompress the following file (cocos2d-iphone-2.1-beta2.tar.gz)
2) Open the terminal and run the CD command to change the current directory environment.
[CD command Description: Change directory]
3) obtain the path of the decompressed folder, select the decompressed file, and right-click "show Introduction"
In the pop-up box, you can see the location information:/volumes/HD2-iOS/6-Games copy it
Execute commands on the terminal
CDS/volumes/HD2-iOS/6-Games
CD cocos2d-iphone-2.1-beta2
/Install-templates.sh
======================================
A logon password is prompted during installation.
Logs printed during installation:
Installing cocos2d templates
----------------------------------------------------
... Creating destination Directory:/users/Apple/library/developer/xcode/templates/cocos2d v2.x/
... Copying cocos2d files
... Copying cocosdenshion files
... Copying cocosdenshionextras files
... Copying kazmath files
... Copying template files
Done!
Installing physics engines templates
----------------------------------------------------
... Copying box2d files
... Copying chipmunk files
Done!
Installing JS bindings templates
----------------------------------------------------
... Copying jsbindings files
... Copying spidermonkey files
... Copying Jr swizzle files
... Copying cocosbuilderreader files
Done!
Installing ccnode file templates...
----------------------------------------------------
... Creating destination Directory:/users/Apple/library/developer/xcode/templates/file templates/cocos2d v2.x/
Done!
Here, the cocos2d template is installed.
4) Open xcode and you will see the cocos2d Project template.
5) use the cocos2d template to create a helloworld game without writing a line of code.
Click "Next"
After the project is created, you can view the project structure.
Click the "run button" on the interface or press the shortcut key: Command + R, you can run the cocos2d-helloworld game.
Cocos2d iPhone environment setup