[英]Ruby on Rails: Why do I have to use sudo for commands to succede?
我正在學習ruby on rails ...我已經能夠在OSX(10.8.3)本地主機上安裝應用程序,但是除非我使用sudo,否則大多數命令都會失敗,並會出現與權限相關的錯誤:
$ refinerycms ./
$ bundle install
$ bundle update
$ rails server
所有這些全都失敗了,沒有sudo...
而且我不知道為什么。 這樣做有點麻煩,但更重要的是,似乎我在設置過程中一定做錯了一些才能做到這一點。 有誰知道我做錯了什么以及如何解決?
更新我懷疑這可能是相關的:(請注意, 兩者都指向同一個地方。)
$ gem environment
RubyGems Environment:
- RUBYGEMS VERSION: 2.0.3
- RUBY VERSION: 1.9.3 (2012-04-20 patchlevel 194) [x86_64-darwin11.4.0]
- INSTALLATION DIRECTORY: /usr/local/rvm/gems/ruby-1.9.3-p194
- RUBY EXECUTABLE: /usr/local/rvm/rubies/ruby-1.9.3-p194/bin/ruby
- EXECUTABLE DIRECTORY: /usr/local/rvm/gems/ruby-1.9.3-p194/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-darwin-11
- GEM PATHS:
- /usr/local/rvm/gems/ruby-1.9.3-p194
- /usr/local/rvm/gems/ruby-1.9.3-p194@global
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- https://rubygems.org/
$ sudo gem environment
Password:
RubyGems Environment:
- RUBYGEMS VERSION: 2.0.3
- RUBY VERSION: 1.9.3 (2012-04-20 patchlevel 194) [x86_64-darwin11.4.0]
- INSTALLATION DIRECTORY: /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/gems/1.9.1
- RUBY EXECUTABLE: /usr/local/rvm/rubies/ruby-1.9.3-p194/bin/ruby
- EXECUTABLE DIRECTORY: /usr/local/rvm/rubies/ruby-1.9.3-p194/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-darwin-11
- GEM PATHS:
- /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/gems/1.9.1
- /Users/ESL/.gem/ruby/1.9.1
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- https://rubygems.org/
這可能與或可能與~/.rvm
不存在的事實有關。 它似乎沒有.rvm
存在於任何地方。
更新2我對Rails應用程序了解不多,但是我注意到某些文件似乎歸系統所有,而不是我的用戶所有。 那是正常的嗎?
更新3我的直覺是我所有的gem都與root關聯,而不與我的用戶關聯,這可以解釋為什么每次嘗試執行操作時都會出現權限錯誤。 所以我嘗試以用戶身份重新安裝rvm ...
$ \curl -L https://get.rvm.io | bash -s stable
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 184 100 184 0 0 192 0 --:--:-- --:--:-- --:--:-- 223
100 13641 100 13641 0 0 9060 0 0:00:01 0:00:01 --:--:-- 9060
Downloading RVM from wayneeseguin branch stable
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 124 100 124 0 0 381 0 --:--:-- --:--:-- --:--:-- 475
100 3263k 100 3263k 0 0 536k 0 0:00:06 0:00:06 --:--:-- 615k
Upgrading the RVM installation in /usr/local/rvm/
RVM PATH line found in /Users/ESL/.bashrc /Users/ESL/.zshrc.
RVM sourcing line found in /Users/ESL/.bash_profile /Users/ESL/.zprofile.
Upgrade Notes:
* WARNING: you have 'rvm_configure_env' in /etc/rvmrc, run the following to fix:
sudo sed -i'' -e "/rvm_configure_env=.*\/opt\/sm/d" /etc/rvmrc
rvm autolibs smf
* No new notes to display.
# RVM: Shell scripts enabling management of multiple ruby environments.
# RTFM: https://rvm.io/
# HELP: http://webchat.freenode.net/?channels=rvm (#rvm on irc.freenode.net)
# Cheatsheet: http://cheat.errtheblog.com/s/rvm
# Screencast: http://screencasts.org/episodes/how-to-use-rvm
# In case of any issues run 'rvm requirements' or read 'rvm notes'
Upgrade of RVM in /usr/local/rvm/ is complete.
#
# Thank you for using RVM!
# I sincerely hope that RVM helps to make your life easier and
# more enjoyable!!!
#
# ~Wayne
It seems to have worked, but it looks to me like it keeps landing in the root instead of /Users/ME. Am I onto something?
更新
$ \curl -L https://get.rvm.io | bash -s stable
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 184 100 184 0 0 124 0 0:00:01 0:00:01 --:--:-- 143
100 13641 100 13641 0 0 6907 0 0:00:01 0:00:01 --:--:-- 6907
Downloading RVM from wayneeseguin branch stable
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 124 100 124 0 0 561 0 --:--:-- --:--:-- --:--:-- 712
100 3263k 100 3263k 0 0 767k 0 0:00:04 0:00:04 --:--:-- 907k
Installing RVM to /usr/local/rvm/
RVM PATH line found in /Users/ESL/.bashrc /Users/ESL/.zshrc.
RVM sourcing line found in /Users/ESL/.bash_profile /Users/ESL/.zprofile.
# RVM: Shell scripts enabling management of multiple ruby environments.
# RTFM: https://rvm.io/
# HELP: http://webchat.freenode.net/?channels=rvm (#rvm on irc.freenode.net)
# Cheatsheet: http://cheat.errtheblog.com/s/rvm
# Screencast: http://screencasts.org/episodes/how-to-use-rvm
# In case of any issues run 'rvm requirements' or read 'rvm notes'
Installation of RVM in /usr/local/rvm/ is almost complete:
* First you need to add all users that will be using rvm to 'rvm' group,
and logout - login again, anyone using rvm will be operating with `umask u=rwx,g=rwx,o=rx`.
* To start using RVM you need to run `source /usr/local/rvm/scripts/rvm`
in all your open shell windows, in rare cases you need to reopen all shell windows.
#
# Thank you for using RVM!
# I sincerely hope that RVM helps to make your life easier and
# more enjoyable!!!
#
# ~Wayne
您未正確安裝RVM,這很容易做到。 “這通常是因為人們以root身份執行安裝,而不是從非特權用戶帳戶執行安裝指令。” 我建議使用sudo rvm implode
完全刪除RVM,然后以單用戶模式再次安裝。 以您的身份而不是root或sudo的身份運行:
\curl -L https://get.rvm.io | bash -s stable
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.