xcode安装cocos2d-x路径问题

问题描述:今天安装cocos2d-x出现如下错误:

Last login: Thu Jun 20 11:49:10 on ttys001
Could-HllmatoMacBook-Pro:~ CouldHll$ /Users/CouldHll/Downloads/cocos2d-x-2.1.4/install-templates-xcode.sh -u -f
cocos2d-x template installer

Installing Xcode 4 cocos2d-x iOS template
----------------------------------------------------

removing old libraries: /Users/CouldHll/Library/Developer/Xcode/Templates/cocos2d-x/
...creating destination directory: /Users/CouldHll/Library/Developer/Xcode/Templates/cocos2d-x/
...copying cocos2d files
rsync: link_stat "/Users/CouldHll/cocos2dx" failed: No such file or directory (2)
rsync error: some files could not be transferred (code 23) at /SourceCache/rsync/rsync-42/rsync/main.c(992) [sender=2.6.9]
rsync: link_stat "/Users/CouldHll/licenses/LICENSE_cocos2d-x.txt" failed: No such file or directory (2)
rsync error: some files could not be transferred (code 23) at /SourceCache/rsync/rsync-42/rsync/main.c(992) [sender=2.6.9]
...copying CocosDenshion files
rsync: link_stat "/Users/CouldHll/CocosDenshion" failed: No such file or directory (2)
rsync error: some files could not be transferred (code 23) at /SourceCache/rsync/rsync-42/rsync/main.c(992) [sender=2.6.9]
...copying websockets files
rsync: link_stat "/Users/CouldHll/external/libwebsockets/ios" failed: No such file or directory (2)
rsync error: some files could not be transferred (code 23) at /SourceCache/rsync/rsync-42/rsync/main.c(992) [sender=2.6.9]
...copying extension files
rsync: link_stat "/Users/CouldHll/extensions" failed: No such file or directory (2)
rsync error: some files could not be transferred (code 23) at /SourceCache/rsync/rsync-42/rsync/main.c(992) [sender=2.6.9]
...copying template files
rsync: link_stat "/Users/CouldHll/template/xcode4/." failed: No such file or directory (2)
rsync error: some files could not be transferred (code 23) at /SourceCache/rsync/rsync-42/rsync/main.c(992) [sender=2.6.9]
done!

Installing Xcode 4 Chipmunk iOS template
----------------------------------------------------

...copying Chipmunk files
rsync: link_stat "/Users/CouldHll/external/chipmunk" failed: No such file or directory (2)
rsync error: some files could not be transferred (code 23) at /SourceCache/rsync/rsync-42/rsync/main.c(992) [sender=2.6.9]
rsync: link_stat "/Users/CouldHll/licenses/LICENSE_chipmunk.txt" failed: No such file or directory (2)
rsync error: some files could not be transferred (code 23) at /SourceCache/rsync/rsync-42/rsync/main.c(992) [sender=2.6.9]
done!

Installing Xcode 4 Box2d iOS template
----------------------------------------------------

...copying Box2D files
rsync: link_stat "/Users/CouldHll/external/Box2D" failed: No such file or directory (2)
rsync error: some files could not be transferred (code 23) at /SourceCache/rsync/rsync-42/rsync/main.c(992) [sender=2.6.9]
rsync: link_stat "/Users/CouldHll/licenses/LICENSE_box2d.txt" failed: No such file or directory (2)
rsync error: some files could not be transferred (code 23) at /SourceCache/rsync/rsync-42/rsync/main.c(992) [sender=2.6.9]
done!

Installing Xcode 4 lua iOS template
----------------------------------------------------

...copying lua files
rsync: link_stat "/Users/CouldHll/scripting/lua" failed: No such file or directory (2)
rsync error: some files could not be transferred (code 23) at /SourceCache/rsync/rsync-42/rsync/main.c(992) [sender=2.6.9]
rsync: link_stat "/Users/CouldHll/licenses/LICENSE_lua.txt" failed: No such file or directory (2)
rsync error: some files could not be transferred (code 23) at /SourceCache/rsync/rsync-42/rsync/main.c(992) [sender=2.6.9]
rsync: link_stat "/Users/CouldHll/licenses/LICENSE_tolua++.txt" failed: No such file or directory (2)
rsync error: some files could not be transferred (code 23) at /SourceCache/rsync/rsync-42/rsync/main.c(992) [sender=2.6.9]
done!

Installing Xcode 4 JS iOS template
----------------------------------------------------

...copying js files
rsync: link_stat "/Users/CouldHll/scripting/javascript/bindings" failed: No such file or directory (2)
rsync error: some files could not be transferred (code 23) at /SourceCache/rsync/rsync-42/rsync/main.c(992) [sender=2.6.9]
rsync: link_stat "/Users/CouldHll/licenses/LICENSE_js.txt" failed: No such file or directory (2)
rsync error: some files could not be transferred (code 23) at /SourceCache/rsync/rsync-42/rsync/main.c(992) [sender=2.6.9]
done!
...copying spidermonkey files
rsync: link_stat "/Users/CouldHll/scripting/javascript/spidermonkey-ios" failed: No such file or directory (2)
rsync error: some files could not be transferred (code 23) at /SourceCache/rsync/rsync-42/rsync/main.c(992) [sender=2.6.9]
done!
done!
Could-HllmatoMacBook-Pro:~ CouldHll$ /Users/CouldHll/Downloads/cocos2d-x-2.1.4/install-templates-xcode.sh
cocos2d-x template installer

Error: This script must be run as root in order to copy templates to /Library/Application Support/Developer/Shared/Xcode

Try running it with 'sudo', or with '-u' to install it only you:
sudo /Users/CouldHll/Downloads/cocos2d-x-2.1.4/install-templates-xcode.sh
or:
/Users/CouldHll/Downloads/cocos2d-x-2.1.4/install-templates-xcode.sh -u
Could-HllmatoMacBook-Pro:~ CouldHll$ /Users/CouldHll/Downloads/cocos2d-x-2.1.4/install-templates-xcode.sh
cocos2d-x template installer

Error: This script must be run as root in order to copy templates to /Library/Application Support/Developer/Shared/Xcode

Try running it with 'sudo', or with '-u' to install it only you:
sudo /Users/CouldHll/Downloads/cocos2d-x-2.1.4/install-templates-xcode.sh
or:
/Users/CouldHll/Downloads/cocos2d-x-2.1.4/install-templates-xcode.sh -u
Could-HllmatoMacBook-Pro:~ CouldHll$ sudo /Users/CouldHll/Downloads/cocos2d-x-2.1.4/install-templates-xcode.sh
Password:
cocos2d-x template installer

Installing Xcode 4 cocos2d-x iOS template
----------------------------------------------------

templates already installed. To force a re-install use the '-f' parameter
Could-HllmatoMacBook-Pro:~ CouldHll$ sudo /Users/CouldHll/Downloads/cocos2d-x-2.1.4/install-templates-xcode.sh -f
cocos2d-x template installer

Installing Xcode 4 cocos2d-x iOS template
----------------------------------------------------

removing old libraries: /Users/CouldHll/Library/Developer/Xcode/Templates/cocos2d-x/
...creating destination directory: /Users/CouldHll/Library/Developer/Xcode/Templates/cocos2d-x/
...copying cocos2d files
rsync: link_stat "/Users/CouldHll/cocos2dx" failed: No such file or directory (2)
rsync error: some files could not be transferred (code 23) at /SourceCache/rsync/rsync-42/rsync/main.c(992) [sender=2.6.9]
rsync: link_stat "/Users/CouldHll/licenses/LICENSE_cocos2d-x.txt" failed: No such file or directory (2)
rsync error: some files could not be transferred (code 23) at /SourceCache/rsync/rsync-42/rsync/main.c(992) [sender=2.6.9]
...copying CocosDenshion files
rsync: link_stat "/Users/CouldHll/CocosDenshion" failed: No such file or directory (2)
rsync error: some files could not be transferred (code 23) at /SourceCache/rsync/rsync-42/rsync/main.c(992) [sender=2.6.9]
...copying websockets files
rsync: link_stat "/Users/CouldHll/external/libwebsockets/ios" failed: No such file or directory (2)
rsync error: some files could not be transferred (code 23) at /SourceCache/rsync/rsync-42/rsync/main.c(992) [sender=2.6.9]
...copying extension files
rsync: link_stat "/Users/CouldHll/extensions" failed: No such file or directory (2)
rsync error: some files could not be transferred (code 23) at /SourceCache/rsync/rsync-42/rsync/main.c(992) [sender=2.6.9]
...copying template files
rsync: link_stat "/Users/CouldHll/template/xcode4/." failed: No such file or directory (2)
rsync error: some files could not be transferred (code 23) at /SourceCache/rsync/rsync-42/rsync/main.c(992) [sender=2.6.9]
done!

Installing Xcode 4 Chipmunk iOS template
----------------------------------------------------

...copying Chipmunk files
rsync: link_stat "/Users/CouldHll/external/chipmunk" failed: No such file or directory (2)
rsync error: some files could not be transferred (code 23) at /SourceCache/rsync/rsync-42/rsync/main.c(992) [sender=2.6.9]
rsync: link_stat "/Users/CouldHll/licenses/LICENSE_chipmunk.txt" failed: No such file or directory (2)
rsync error: some files could not be transferred (code 23) at /SourceCache/rsync/rsync-42/rsync/main.c(992) [sender=2.6.9]
done!

Installing Xcode 4 Box2d iOS template
----------------------------------------------------

...copying Box2D files
rsync: link_stat "/Users/CouldHll/external/Box2D" failed: No such file or directory (2)
rsync error: some files could not be transferred (code 23) at /SourceCache/rsync/rsync-42/rsync/main.c(992) [sender=2.6.9]
rsync: link_stat "/Users/CouldHll/licenses/LICENSE_box2d.txt" failed: No such file or directory (2)
rsync error: some files could not be transferred (code 23) at /SourceCache/rsync/rsync-42/rsync/main.c(992) [sender=2.6.9]
done!

Installing Xcode 4 lua iOS template
----------------------------------------------------

...copying lua files
rsync: link_stat "/Users/CouldHll/scripting/lua" failed: No such file or directory (2)
rsync error: some files could not be transferred (code 23) at /SourceCache/rsync/rsync-42/rsync/main.c(992) [sender=2.6.9]
rsync: link_stat "/Users/CouldHll/licenses/LICENSE_lua.txt" failed: No such file or directory (2)
rsync error: some files could not be transferred (code 23) at /SourceCache/rsync/rsync-42/rsync/main.c(992) [sender=2.6.9]
rsync: link_stat "/Users/CouldHll/licenses/LICENSE_tolua++.txt" failed: No such file or directory (2)
rsync error: some files could not be transferred (code 23) at /SourceCache/rsync/rsync-42/rsync/main.c(992) [sender=2.6.9]
done!

Installing Xcode 4 JS iOS template
----------------------------------------------------

...copying js files
rsync: link_stat "/Users/CouldHll/scripting/javascript/bindings" failed: No such file or directory (2)
rsync error: some files could not be transferred (code 23) at /SourceCache/rsync/rsync-42/rsync/main.c(992) [sender=2.6.9]
rsync: link_stat "/Users/CouldHll/licenses/LICENSE_js.txt" failed: No such file or directory (2)
rsync error: some files could not be transferred (code 23) at /SourceCache/rsync/rsync-42/rsync/main.c(992) [sender=2.6.9]
done!
...copying spidermonkey files
rsync: link_stat "/Users/CouldHll/scripting/javascript/spidermonkey-ios" failed: No such file or directory (2)
rsync error: some files could not be transferred (code 23) at /SourceCache/rsync/rsync-42/rsync/main.c(992) [sender=2.6.9]
done!
done!
Could-HllmatoMacBook-Pro:~ CouldHll$

问题解决:安装脚本是需要在安装程序目录的,所以要先进入安装目录:

Could-HllmatoMacBook-Pro:cocos2d-x-2.1.4 CouldHll$ cd /Users/CouldHll/Downloads/cocos2d-x-2.1.4

然后安装,一切正常。