I would like to clarify this issue. I had installed Cocos2d 1.01 rc on my iMac, with XCode 4.3 installed, and I have now dowloaded v2.0 and wanted to install the templates (following the official guide). Unfortunately the terminal gives me permission denied messages on trying this operation.
I thought all I needed to do was a "sudo su" command and then a chmod and that's what I tried to do:
sudo su
chmod -R 0777 /Users/xxx/Library/Developer/Xcode/Templates/*
The result of this is which seems fine to me (read, write and execute on all subdirectories of Templates):
ls -l /Users/xxxx/Library/Developer/Xcode/Templates/
total 0
drwxrwxrwx 4 root staff 136 20 Giu 17:30 File Templates
drwxrwxrwx 19 root staff 646 15 Mar 15:14 cocos2d
But when I install the templates I get the following, which I don't quiet get.. It say "DONE!" but there are several errors in the terminal that say that was not possible to create directories because of permission (even if they all seem to have r,w,x set). Also, well I try to create an empty Cocos2d project via XCode (after rebooting XCode) the cocos2d.m still shows version v1.0.1.
For clarity here is the log from terminal after attempting to install the templates (I am a bit lost):
./install-templates.sh -f
cocos2d-iphone template installer
Installing Xcode 4 cocos2d iOS template
----------------------------------------------------
...creating destination directory: /Users/xxx/Library/Developer/Xcode/Templates/cocos2d v2.x/
mkdir: /Users/xxx/Library/Developer/Xcode/Templates/cocos2d v2.x: Permission denied
mkdir: /Users/xxx/Library/Developer/Xcode/Templates/cocos2d v2.x: Permission denied
...copying cocos2d files
rsync: mkdir "/Users/xxx/Library/Developer/Xcode/Templates/cocos2d v2.x/lib_cocos2d.xctemplate/libs" failed: No such file or directory (2)
rsync error: error in file IO (code 11) at /SourceCache/rsync/rsync-42/rsync/main.c(544) [receiver=2.6.9]
rsync: connection unexpectedly closed (8 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at /SourceCache/rsync/rsync-42/rsync/io.c(452) [sender=2.6.9]
rsync: mkdir "/Users/xxx/Library/Developer/Xcode/Templates/cocos2d v2.x/lib_cocos2d.xctemplate/libs" failed: No such file or directory (2)
rsync error: error in file IO (code 11) at /SourceCache/rsync/rsync-42/rsync/main.c(544) [receiver=2.6.9]
rsync: connection unexpectedly closed (8 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at /SourceCache/rsync/rsync-42/rsync/io.c(452) [sender=2.6.9]
mkdir: /Users/xxx/Library/Developer/Xcode/Templates/cocos2d v2.x: Permission denied
...copying CocosDenshion files
rsync: mkdir "/Users/xxx/Library/Developer/Xcode/Templates/cocos2d v2.x/lib_cocosdenshion.xctemplate/libs" failed: No such file or directory (2)
rsync error: error in file IO (code 11) at /SourceCache/rsync/rsync-42/rsync/main.c(544) [receiver=2.6.9]
rsync: connection unexpectedly closed (8 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at /SourceCache/rsync/rsync-42/rsync/io.c(452) [sender=2.6.9]
rsync: mkdir "/Users/xxx/Library/Developer/Xcode/Templates/cocos2d v2.x/lib_cocosdenshion.xctemplate/libs" failed: No such file or directory (2)
rsync error: error in file IO (code 11) at /SourceCache/rsync/rsync-42/rsync/main.c(544) [receiver=2.6.9]
rsync: connection unexpectedly closed (8 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at /SourceCache/rsync/rsync-42/rsync/io.c(452) [sender=2.6.9]
mkdir: /Users/xxx/Library/Developer/Xcode/Templates/cocos2d v2.x: Permission denied
...copying CocosDenshionExtras files
rsync: mkdir "/Users/xxx/Library/Developer/Xcode/Templates/cocos2d v2.x/lib_cocosdenshionextras.xctemplate/libs" failed: No such file or directory (2)
rsync error: error in file IO (code 11) at /SourceCache/rsync/rsync-42/rsync/main.c(544) [receiver=2.6.9]
rsync: connection unexpectedly closed (8 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at /SourceCache/rsync/rsync-42/rsync/io.c(452) [sender=2.6.9]
mkdir: /Users/xxx/Library/Developer/Xcode/Templates/cocos2d v2.x: Permission denied
...copying Kazmath files
rsync: mkdir "/Users/xxx/Library/Developer/Xcode/Templates/cocos2d v2.x/lib_kazmath.xctemplate/libs" failed: No such file or directory (2)
rsync error: error in file IO (code 11) at /SourceCache/rsync/rsync-42/rsync/main.c(544) [receiver=2.6.9]
rsync: connection unexpectedly closed (8 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at /SourceCache/rsync/rsync-42/rsync/io.c(452) [sender=2.6.9]
rsync: mkdir "/Users/xxx/Library/Developer/Xcode/Templates/cocos2d v2.x/lib_kazmath.xctemplate/libs" failed: No such file or directory (2)
rsync error: error in file IO (code 11) at /SourceCache/rsync/rsync-42/rsync/main.c(544) [receiver=2.6.9]
rsync: connection unexpectedly closed (8 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at /SourceCache/rsync/rsync-42/rsync/io.c(452) [sender=2.6.9]
...copying template files
rsync: mkdir "/Users/xxx/Library/Developer/Xcode/Templates/cocos2d v2.x" failed: Permission denied (13)
rsync error: error in file IO (code 11) at /SourceCache/rsync/rsync-42/rsync/main.c(544) [receiver=2.6.9]
rsync: connection unexpectedly closed (8 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at /SourceCache/rsync/rsync-42/rsync/io.c(452) [sender=2.6.9]
done!
Installing Xcode 4 Chipmunk iOS template
----------------------------------------------------
mkdir: /Users/xxx/Library/Developer/Xcode/Templates/cocos2d v2.x: Permission denied
...copying Chipmunk files
rsync: mkdir "/Users/xxx/Library/Developer/Xcode/Templates/cocos2d v2.x/lib_chipmunk.xctemplate/libs" failed: No such file or directory (2)
rsync error: error in file IO (code 11) at /SourceCache/rsync/rsync-42/rsync/main.c(544) [receiver=2.6.9]
rsync: connection unexpectedly closed (8 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at /SourceCache/rsync/rsync-42/rsync/io.c(452) [sender=2.6.9]
rsync: mkdir "/Users/xxx/Library/Developer/Xcode/Templates/cocos2d v2.x/lib_chipmunk.xctemplate/libs" failed: No such file or directory (2)
rsync error: error in file IO (code 11) at /SourceCache/rsync/rsync-42/rsync/main.c(544) [receiver=2.6.9]
rsync: connection unexpectedly closed (8 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at /SourceCache/rsync/rsync-42/rsync/io.c(452) [sender=2.6.9]
done!
Installing Xcode 4 Box2d iOS template
----------------------------------------------------
mkdir: /Users/xxx/Library/Developer/Xcode/Templates/cocos2d v2.x: Permission denied
...copying Box2d files
rsync: mkdir "/Users/xxx/Library/Developer/Xcode/Templates/cocos2d v2.x/lib_box2d.xctemplate/libs" failed: No such file or directory (2)
rsync error: error in file IO (code 11) at /SourceCache/rsync/rsync-42/rsync/main.c(544) [receiver=2.6.9]
rsync: connection unexpectedly closed (8 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at /SourceCache/rsync/rsync-42/rsync/io.c(452) [sender=2.6.9]
rsync: mkdir "/Users/xxx/Library/Developer/Xcode/Templates/cocos2d v2.x/lib_box2d.xctemplate/libs" failed: No such file or directory (2)
rsync error: error in file IO (code 11) at /SourceCache/rsync/rsync-42/rsync/main.c(544) [receiver=2.6.9]
rsync: connection unexpectedly closed (8 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at /SourceCache/rsync/rsync-42/rsync/io.c(452) [sender=2.6.9]
done!
Installing Xcode 4 CCNode file templates...
----------------------------------------------------
...creating destination directory: /Users/xxx/Library/Developer/Xcode/Templates/File Templates/cocos2d v2.x/
mv: rename /Users/xxx/Library/Developer/Xcode/Templates/cocos2d v2.x//CCNode class.xctemplate to /Users/xxx/Library/Developer/Xcode/Templates/File Templates/cocos2d v2.x/CCNode class.xctemplate: No such file or directory
done!
Any help would be appreciated :), thanks!
EDIT: Trying
sudo ./install-templates.sh -f
gives:
cocos2d-iphone template installer
Error: Do not run this script as root.
'root' is no longer supported
RECOMMENDED WAY:
./install-templates.sh -f
EDIT 2:
I tried to remove the cocos2d folders inside the Templates directory as following:
drwxrwxrwx 3 root staff 102 15 Mar 15:14 cocos2d
drwxr-xr-x 2 user staff 68 20 Giu 17:30 cocos2d v2.x
imac-di-user:File Templates user$ cd ..
imac-di-user:Templates user$ ls
File Templates cocos2d
imac-di-user:Templates user$ sudo rm -rf *
Password:
imac-di-user:Templates user$ ls
And showed no directories left. Then I went back to the folder containing the dowloaded files of Cocos2d 2.x and I lunched the install script as following:
imac-di-daniele:cocos2d-iphone-2.0-rc2 user$ ./install-templates.sh -f
Unfortunately it still fails to install them and now I am left with no templats. Here is the output from the console:
./install-templates.sh -f
cocos2d-iphone template installer
Installing Xcode 4 cocos2d iOS template
----------------------------------------------------
...creating destination directory: /Users/user/Library/Developer/Xcode/Templates/cocos2d v2.x/
mkdir: /Users/user/Library/Developer/Xcode/Templates/cocos2d v2.x: Permission denied
mkdir: /Users/user/Library/Developer/Xcode/Templates/cocos2d v2.x: Permission denied
...copying cocos2d files
rsync: mkdir "/Users/user/Library/Developer/Xcode/Templates/cocos2d v2.x/lib_cocos2d.xctemplate/libs" failed: No such file or directory (2)
rsync error: error in file IO (code 11) at /SourceCache/rsync/rsync-42/rsync/main.c(544) [receiver=2.6.9]
rsync: connection unexpectedly closed (8 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at /SourceCache/rsync/rsync-42/rsync/io.c(452) [sender=2.6.9]
rsync: mkdir "/Users/user/Library/Developer/Xcode/Templates/cocos2d v2.x/lib_cocos2d.xctemplate/libs" failed: No such file or directory (2)
rsync error: error in file IO (code 11) at /SourceCache/rsync/rsync-42/rsync/main.c(544) [receiver=2.6.9]
rsync: connection unexpectedly closed (8 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at /SourceCache/rsync/rsync-42/rsync/io.c(452) [sender=2.6.9]
mkdir: /Users/user/Library/Developer/Xcode/Templates/cocos2d v2.x: Permission denied
...copying CocosDenshion files
rsync: mkdir "/Users/user/Library/Developer/Xcode/Templates/cocos2d v2.x/lib_cocosdenshion.xctemplate/libs" failed: No such file or directory (2)
rsync error: error in file IO (code 11) at /SourceCache/rsync/rsync-42/rsync/main.c(544) [receiver=2.6.9]
rsync: connection unexpectedly closed (8 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at /SourceCache/rsync/rsync-42/rsync/io.c(452) [sender=2.6.9]
rsync: mkdir "/Users/user/Library/Developer/Xcode/Templates/cocos2d v2.x/lib_cocosdenshion.xctemplate/libs" failed: No such file or directory (2)
rsync error: error in file IO (code 11) at /SourceCache/rsync/rsync-42/rsync/main.c(544) [receiver=2.6.9]
rsync: connection unexpectedly closed (8 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at /SourceCache/rsync/rsync-42/rsync/io.c(452) [sender=2.6.9]
mkdir: /Users/user/Library/Developer/Xcode/Templates/cocos2d v2.x: Permission denied
...copying CocosDenshionExtras files
rsync: mkdir "/Users/user/Library/Developer/Xcode/Templates/cocos2d v2.x/lib_cocosdenshionextras.xctemplate/libs" failed: No such file or directory (2)
rsync error: error in file IO (code 11) at /SourceCache/rsync/rsync-42/rsync/main.c(544) [receiver=2.6.9]
rsync: connection unexpectedly closed (8 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at /SourceCache/rsync/rsync-42/rsync/io.c(452) [sender=2.6.9]
mkdir: /Users/user/Library/Developer/Xcode/Templates/cocos2d v2.x: Permission denied
...copying Kazmath files
rsync: mkdir "/Users/user/Library/Developer/Xcode/Templates/cocos2d v2.x/lib_kazmath.xctemplate/libs" failed: No such file or directory (2)
rsync error: error in file IO (code 11) at /SourceCache/rsync/rsync-42/rsync/main.c(544) [receiver=2.6.9]
rsync: connection unexpectedly closed (8 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at /SourceCache/rsync/rsync-42/rsync/io.c(452) [sender=2.6.9]
rsync: mkdir "/Users/user/Library/Developer/Xcode/Templates/cocos2d v2.x/lib_kazmath.xctemplate/libs" failed: No such file or directory (2)
rsync error: error in file IO (code 11) at /SourceCache/rsync/rsync-42/rsync/main.c(544) [receiver=2.6.9]
rsync: connection unexpectedly closed (8 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at /SourceCache/rsync/rsync-42/rsync/io.c(452) [sender=2.6.9]
...copying template files
rsync: mkdir "/Users/user/Library/Developer/Xcode/Templates/cocos2d v2.x" failed: Permission denied (13)
rsync error: error in file IO (code 11) at /SourceCache/rsync/rsync-42/rsync/main.c(544) [receiver=2.6.9]
rsync: connection unexpectedly closed (8 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at /SourceCache/rsync/rsync-42/rsync/io.c(452) [sender=2.6.9]
done!
Installing Xcode 4 Chipmunk iOS template
----------------------------------------------------
mkdir: /Users/user/Library/Developer/Xcode/Templates/cocos2d v2.x: Permission denied
...copying Chipmunk files
rsync: mkdir "/Users/user/Library/Developer/Xcode/Templates/cocos2d v2.x/lib_chipmunk.xctemplate/libs" failed: No such file or directory (2)
rsync error: error in file IO (code 11) at /SourceCache/rsync/rsync-42/rsync/main.c(544) [receiver=2.6.9]
rsync: connection unexpectedly closed (8 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at /SourceCache/rsync/rsync-42/rsync/io.c(452) [sender=2.6.9]
rsync: mkdir "/Users/user/Library/Developer/Xcode/Templates/cocos2d v2.x/lib_chipmunk.xctemplate/libs" failed: No such file or directory (2)
rsync error: error in file IO (code 11) at /SourceCache/rsync/rsync-42/rsync/main.c(544) [receiver=2.6.9]
rsync: connection unexpectedly closed (8 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at /SourceCache/rsync/rsync-42/rsync/io.c(452) [sender=2.6.9]
done!
Installing Xcode 4 Box2d iOS template
----------------------------------------------------
mkdir: /Users/user/Library/Developer/Xcode/Templates/cocos2d v2.x: Permission denied
...copying Box2d files
rsync: mkdir "/Users/user/Library/Developer/Xcode/Templates/cocos2d v2.x/lib_box2d.xctemplate/libs" failed: No such file or directory (2)
rsync error: error in file IO (code 11) at /SourceCache/rsync/rsync-42/rsync/main.c(544) [receiver=2.6.9]
rsync: connection unexpectedly closed (8 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at /SourceCache/rsync/rsync-42/rsync/io.c(452) [sender=2.6.9]
rsync: mkdir "/Users/user/Library/Developer/Xcode/Templates/cocos2d v2.x/lib_box2d.xctemplate/libs" failed: No such file or directory (2)
rsync error: error in file IO (code 11) at /SourceCache/rsync/rsync-42/rsync/main.c(544) [receiver=2.6.9]
rsync: connection unexpectedly closed (8 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at /SourceCache/rsync/rsync-42/rsync/io.c(452) [sender=2.6.9]
done!
Installing Xcode 4 CCNode file templates...
----------------------------------------------------
...creating destination directory: /Users/user/Library/Developer/Xcode/Templates/File Templates/cocos2d v2.x/
mkdir: /Users/user/Library/Developer/Xcode/Templates/File Templates: Permission denied
mv: rename /Users/user/Library/Developer/Xcode/Templates/cocos2d v2.x//CCNode class.xctemplate to /Users/user/Library/Developer/Xcode/Templates/File Templates/cocos2d v2.x/: No such file or directory
done!
Navigate to this folder in Finder:
/Users/xxx/Library/Developer/Xcode/Templates
Locate all folders that begin with "cocos2d". There should be two of those, one for project templates the other for file templates.
Delete these folders. You'll be asked to enter your password because it'll require superuser priviliges. Once the old folders are gone, you can install the templates.
The error occurs because you've previously installed the templates with sudo
. The current templates installer script doesn't run with sudo
(and fails if you try as you've already found out) and is therefore unable to remove/replace the template files previously created by the superuser. Therefore simply deleting the folders fixes the problem whereas chmod
does not.
After several attempts, this worked for me. It is just a clarification of the answers from above, with more details. Note:I'm using a MacBook Pro, with MountainLion 10.8.2). And, I have a good working install of coco2d v1.x.
** This process will install cocos2D v2.0 and the Templates **
After you download cocos2d-iphone-2.0.tar
(uncompress it and leave on desktop)
Note: I did not use sudo, -u, or -f
. also I don't reference cocos2d-iphone-2.0
folder in the terminal (just the install document).
1: sudo chmod -R 777 /Users/YOU NAME/Library/Developer/Xcode/Templates
2: ./install-templates.sh -f
3: sudo chmod -R 755 /Users/YOU NAME/Library/Developer/Xcode/Templates
Good Luck
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With