Cmake compile cocos2d-x error [How to Solve]

Enter at the terminal:

cocos run --proj-dir .. -p mac

The error information is as follows:

-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
CMake Error at CMakeLists.txt:30 (project):
  No CMAKE_C_COMPILER could be found.



CMake Error at CMakeLists.txt:30 (project):
  No CMAKE_CXX_COMPILER could be found.



-- Configuring incomplete, errors occurred!
See also "/Users/roy/Desktop/workspace/CocosProject/MyGame/mac-build/CMakeFiles/CMakeOutput.log".
See also "/Users/roy/Desktop/workspace/CocosProject/MyGame/mac-build/CMakeFiles/CMakeError.log".

Solution:

sudo xcode-select --reset

Read More: