Cocos2d-js cocos command not found



I am getting error
"cocos: command not found"

I tried all the steps mentioned in install

./ and adding environment variables to .profile

Here is the console log


Setting up cocos2d-x…

-> Adding COCOS2D_CONSOLE_ROOT environment variable… ALREADY ADDED

-> Looking for NDK_ROOT envrironment variable… FOUND

-> Looking for ANDROID_SDK_ROOT envrironment variable… FOUND

-> Looking for ANT_ROOT envrironment variable… FOUND

COCOS_CONSOLE_ROOT was already added. Edit “/Users/gamebox/.profile” for manual changes

Please execute command: “source /Users/gamebox/.profile” to make added system variables take effect

gamebox:cocos2d-js$source /Users/gamebox/.profile

echo $PATH contains

How to create new game with cocos command from console - I’m on Mac OS - cocos2d-js 3.0


We had the same issue, the resources online don’t tell you that you have to change your directory in the terminal to run the command.

Change to cocos2d-xroot/tools/cocos2d-console/bin

The command is also a python file so run it as or ./

Hope that helps :smiley:

Check out our channel which has tutorials on Cocos2d-x with V3 tutorials coming very soon.


Hi, @indygamer @SonarSystems

I didn’t know why you got the message Please execute command: "source /Users/gamebox/.profile" to make added system variables take effect
The right message should be source /Users/gamebox/.bash_profile if you use a Mac
I will report this issue to our cocos console developer.
Sorry for the inconvenience



I think it’s because of the incorrect permission of file /Users/gamebox/cocos2d-js/tools/cocos2d-console/bin/cocos. Maybe it doesn’t have permission of execute.

Can you take a look at the file? Whether it has the permission of execute? Use this command in terminal:

ls -l /Users/gamebox/cocos2d-js/tools/cocos2d-console/bin/cocos

The permission of my cocos is : -rwxr-xr-x


Thanks all. Found a workaround solution, I had tried to
git clone
and then
git submodule update --init

For some reason, all the submodules were not updated.

Later downloaded the official zip release and replaced the directory contents. Now its working fine.

Cocos2d-x 3.6 still sh: cocos: command not found
How to Create a New Cocos2d-x Project in Linux Mint 64-bit? *SOLVED*

@pandamicro thx,i resolve it through your idea.