Fixing Rails permission problems on the mac

About three times a week, people message me or mail me with questions about their Rails app having permission problems. I’m posting this so people can figure this out themselves (not that I don’t appreciate the kind words that come with the questions).

Powerbook:~ tony$ mkdir /Library/WebServer/Rails
Powerbook:~ tony$ chgrp www /Library/WebServer/Rails
Powerbook:~ tony$ cd /Library/WebServer/Rails
Powerbook:~ tony$ rails ./MyWondrousRailsApp

So long as you create your Rails apps there, you shouldn’t have any problems. Basically, it looks like Rails needs read access to all of your application path – hence putting it in your home directory will result in your application throwing an error. Natch

Comments

Generic user icon.

If I remem­ber well the doc­u­men­ta­tion, the web­server user needs *write* access to log/​and public/

The for­mer seems log­i­cal if you want to read your logs =8)

The lat­ter prob­a­bly stands for caching pages. With­out write access to the pub­lic (aka Doc­u­men­t­Root), I won­der how the web­server could cache anything.

That said, I'm not an expert but that seems obvi­ous from here.

$ cd /​path/​to/​rails/​app/​

$ sudo chgrp –R www-​data log/​public/​

$ sudo chmod 0775 log/​public/​

I've seen some pages adver­tis­ing chmod 0777 (i.e. world-​writable) to log/​and public/​but that's gen­er­ally a bad idea to give more priv­i­leges than necessary.

Posted by hellekin on

Sorry, this conversation has finished.

This post is a bit old now, so I've closed the conversation. If you're keen to keep talking about it, please email me directly.