简体   繁体   中英

Permission denied when creating new rails app

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>'

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM