macOS Installation and Setup
Prerequisites
A supported environment. See Installation Prerequisites
Setting up Cocos2d-x
You can get started with Cocos2d-x by either downloading a self-contained .zip from the website or by cloning our GitHub Repo. Pick what works for you. There is no need to do both.
By downloading a .zip archive
Download Cocos2d-x and unzip it. (maybe: ~/ or ~/Projects )
Cloning from GitHub
Use the following commands to clone our GitHub repo and get your environment setup. If you are not familar with GitHub's workflow, learn it or download using the step above, By downloading a .zip archive.
cd <to where you want to clone this repo>
git clone git@github.com:cocos2d/cocos2d-x.git
git submodule update --init
git submodule update
./download-deps.py
Build and Run
Use cmake
cd COCOS2DX/tests/cpp-tests
mkdir mac-build
cd mac-build
cmake ..
make
Use Xcode
First use CMake to generate Xcode project,
cd COCOS2DX/tests/cpp-tests
mkdir mac-build
cd mac-build
cmake .. -GXcode
then open cpp-tests.xcodeproj
and select cpp-tests
to run.
Use cocos command line tools
cd COCOS2DX/tests/cpp-tests
cocos run -p mac
Starting a new project
Once everything above works, you can start a new project! To do this, read our document on the Cocos Command-line tool.
Troubleshooting
Please see this F.A.Q for troubleshooting help.