2

I'm getting a permission denied when attempting to create a new rails app - and I'm at a bit of a loss as to why. I installed Ruby 1.9.3 (I'm aware Mac OSX Lion ships with ruby, but an older version). When installing, I did not have to sudo.

Also, when installing rails, I did not sudo the gem install either.

It appears the only way I can create a new rails app is to sudo the comment though. Here is the trace of the error:

Brians-MacBook-Air:Sites bkosborne$ rails new blog
      create  
/Users/bkosborne/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/fileutils.rb:247:in `mkdir': Permission denied - /Users/bkosborne/Sites/blog (Errno::EACCES)
    from /Users/bkosborne/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/fileutils.rb:247:in `fu_mkdir'
    from /Users/bkosborne/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/fileutils.rb:221:in `block (2 levels) in mkdir_p'
    from /Users/bkosborne/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/fileutils.rb:219:in `reverse_each'
    from /Users/bkosborne/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/fileutils.rb:219:in `block in mkdir_p'
    from /Users/bkosborne/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/fileutils.rb:205:in `each'
    from /Users/bkosborne/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/fileutils.rb:205:in `mkdir_p'
    from /Users/bkosborne/.rvm/gems/ruby-1.9.3-p125/gems/thor-0.14.6/lib/thor/actions/empty_directory.rb:51:in `block in invoke!'
    from /Users/bkosborne/.rvm/gems/ruby-1.9.3-p125/gems/thor-0.14.6/lib/thor/actions/empty_directory.rb:114:in `call'
    from /Users/bkosborne/.rvm/gems/ruby-1.9.3-p125/gems/thor-0.14.6/lib/thor/actions/empty_directory.rb:114:in `invoke_with_conflict_check'
    from /Users/bkosborne/.rvm/gems/ruby-1.9.3-p125/gems/thor-0.14.6/lib/thor/actions/empty_directory.rb:50:in `invoke!'
    from /Users/bkosborne/.rvm/gems/ruby-1.9.3-p125/gems/thor-0.14.6/lib/thor/actions.rb:95:in `action'
    from /Users/bkosborne/.rvm/gems/ruby-1.9.3-p125/gems/thor-0.14.6/lib/thor/actions/empty_directory.rb:15:in `empty_directory'
    from /Users/bkosborne/.rvm/gems/ruby-1.9.3-p125/gems/railties-3.2.1/lib/rails/generators/app_base.rb:103:in `create_root'
    from (eval):1:in `create_root'
    from /Users/bkosborne/.rvm/gems/ruby-1.9.3-p125/gems/thor-0.14.6/lib/thor/task.rb:22:in `run'
    from /Users/bkosborne/.rvm/gems/ruby-1.9.3-p125/gems/thor-0.14.6/lib/thor/invocation.rb:118:in `invoke_task'
    from /Users/bkosborne/.rvm/gems/ruby-1.9.3-p125/gems/thor-0.14.6/lib/thor/invocation.rb:124:in `block in invoke_all'
    from /Users/bkosborne/.rvm/gems/ruby-1.9.3-p125/gems/thor-0.14.6/lib/thor/invocation.rb:124:in `each'
    from /Users/bkosborne/.rvm/gems/ruby-1.9.3-p125/gems/thor-0.14.6/lib/thor/invocation.rb:124:in `map'
    from /Users/bkosborne/.rvm/gems/ruby-1.9.3-p125/gems/thor-0.14.6/lib/thor/invocation.rb:124:in `invoke_all'
    from /Users/bkosborne/.rvm/gems/ruby-1.9.3-p125/gems/thor-0.14.6/lib/thor/group.rb:226:in `dispatch'
    from /Users/bkosborne/.rvm/gems/ruby-1.9.3-p125/gems/thor-0.14.6/lib/thor/base.rb:389:in `start'
    from /Users/bkosborne/.rvm/gems/ruby-1.9.3-p125/gems/railties-3.2.1/lib/rails/commands/application.rb:38:in `<top (required)>'
    from /Users/bkosborne/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
    from /Users/bkosborne/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
    from /Users/bkosborne/.rvm/gems/ruby-1.9.3-p125/gems/railties-3.2.1/lib/rails/cli.rb:15:in `<top (required)>'
    from /Users/bkosborne/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
    from /Users/bkosborne/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
    from /Users/bkosborne/.rvm/gems/ruby-1.9.3-p125/gems/railties-3.2.1/bin/rails:7:in `<top (required)>'
    from /Users/bkosborne/.rvm/gems/ruby-1.9.3-p125/bin/rails:19:in `load'
    from /Users/bkosborne/.rvm/gems/ruby-1.9.3-p125/bin/rails:19:in `<main>'
Brian
  • 7,204
  • 12
  • 51
  • 84
  • 2
    Can you run `mkdir /Users/bkosborne/Sites/test` without being denied? – Jeremy Feb 23 '12 at 04:18
  • Might want to make sure that your `tmp` folder has permissions... maybe using `chmod 777 tmp`? (http://stackoverflow.com/questions/8127849/rails-3-1-errnoeacces-permission-denied) – summea Feb 23 '12 at 04:19
  • ah wow. I've been doing this too long tonight... yeah the site's folder is owned by root and thus I was unable to create directories within it. I didn't even investigate that because I assumed it wasn't owned by root. Thanks! – Brian Feb 23 '12 at 04:25

1 Answers1

10

/Users/bkosborne/Sites/ doesn't exist or you don't have write permissions into that directory. chown the directory to yourself or chmod it so that you can write into it.

Veraticus
  • 15,944
  • 3
  • 41
  • 45