1

我正在学习 ruby​​ on rails ......我已经能够在我的 OSX (10.8.3) localhost 上安装一个应用程序,但是除非我使用 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
4

1 回答 1

1

您错误地安装了 RVM,这很容易做到。“这通常是因为人们以 root 身份执行安装,而不是从非特权用户帐户执行安装指令。” 我建议完全删除 RVMsudo rvm implode并在单用户模式下重新安装。以你的身份运行,而不是 root,而不是 sudo:

\curl -L https://get.rvm.io | bash -s stable
于 2013-05-04T21:27:40.977 回答