Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am a new Mac user who is starting to learn Ruby on Rails. I have found that I need to use the sudo statement when running commands like

$ sudo rails generate controller home index

But when I do, the files which it generates appear as read-only when I try to edit them in Coda.

I did a Get Info on the file and it appears that the owner is root and the group is staff. alt text

Does my user jesse need to belong to the group staff?

I really just want to be able to edit my files and not screw anything up. If anyone has any guidance for a noob, that would be appreciated.

share|improve this question
1  
I don't think sudo is required for scaffolding and generating, tried w/o sudo ? –  Sathya Sep 7 '10 at 2:21
1  
You're observing normal behavior from using sudo. The solution is probably to properly fix whatever problem led you to use sudo. –  Gilles Sep 7 '10 at 6:44
    
@Sathya, I did try running the command without it, it was throwing some permission denied errors –  jessegavin Sep 7 '10 at 12:26

2 Answers 2

up vote 3 down vote accepted

When you create files with sudo, those files are owned by root. You can either:

  1. Use the inspector window (the one in your screenshot) to change the file owner to yourself, or

  2. Run chown -R jesse myProjectDir on the directory you create to change its owner (and its contents' owner) to yourself.

share|improve this answer
    
Thank you very much that explains it nicely. –  jessegavin Sep 7 '10 at 12:25

The group (staff) doesnt have write access either. Youll have to do:

$ sudo chmod a+w {files}

where {files} is a list of the files that you cant write. Note that if you run rails generate again, theres a good chance youll lose +w and have repeat this. Note also that this makes {files} writeable by all users, so if if you let anyone else use your computer, they'll by able to modify {files}.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.