Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cocos2d v2.x, failing to install templates.. permission denied. Am I doing something stupid?

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!
like image 275
mm24 Avatar asked Jun 20 '12 15:06

mm24


4 Answers

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.

like image 174
LearnCocos2D Avatar answered Nov 11 '22 02:11

LearnCocos2D


  1. Command + Shift + G
  2. ~/Library/Developer/Xcode
  3. remove Templates folder and recreated it
  4. cd ....../cocos2d-iphone-2.0
  5. ./install-templates.sh –f
like image 11
maitrieuphilong Avatar answered Nov 11 '22 01:11

maitrieuphilong


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)

  1. Hit Command + Shift + G (opens your directory search)
  2. Type into search for: /Library/Developer/Xcode (to locate the cocos2d Template folder)
  3. Remove (and backup) that "Template" folder (because the installer will not overwrite the contents)
  4. Create a new "Template" folder in the xCode folder (so the installer will know where to write the new templates)
  5. Open the Terminal, and type cd, then hit enter (to get a fresh line)Leave the terminal open.
  6. Now go to and open your new cocos2d-iphone-2.0 folder, and look for the "install-templates.sh" document.
  7. You should drag that document into the terminal on the current line and hit enter(return)
  8. the install should begin.
  9. start xcode > look for your new coco2s v2.x templates

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).

like image 8
Lawrence Fletcher Avatar answered Nov 11 '22 02:11

Lawrence Fletcher


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

like image 3
Andy Lee Avatar answered Nov 11 '22 02:11

Andy Lee