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.
当我试图创建一个新的rails应用程序时,我得到了一个被拒绝的权限——我有点不知所措。我安装了Ruby 1.9.3(我知道Mac OSX Lion附带了Ruby,但是是旧版本)。安装时,我不需要sudo。
Also, when installing rails, I did not sudo the gem install either.
另外,在安装rails时,我也没有安装gem。
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:
我创建一个新的rails应用程序的唯一方式似乎是sudo注释。这里是错误的痕迹:
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>'
1 个解决方案
#1
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.
/ user /bkosborne/Sites/不存在,或者您没有该目录的写权限。将目录归自己或chmod,以便您可以将其写入。
#1
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.
/ user /bkosborne/Sites/不存在,或者您没有该目录的写权限。将目录归自己或chmod,以便您可以将其写入。