rbenv ruby on rails 全局 vs 本地 vs shell
rbenv ruby on rails global vs local vs shell
// Start background info.
我只想在 rails 上安装 ruby 用于开发(OSX El Capitan)。
痛点:
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /Library/Ruby/Gems/2.0.0 directory.
解决方法:安装rbenv来管理/修改单独的ruby.
rbenv 当前正在使用我的系统 ruby - 所以我通过 rbenv install 下载了一个相同的版本。
// end background info.
实际问题:我是否将 rbenv 本地、全局或 shell ruby 版本设置为新下载的版本?
通常 rbenv
会为您做脏活累活 if loaded correctly,但如果您需要更改 global 设置,您可以随时更新它:
rbenv global 2.3.0
然后您可以检查应用是否正确:
rbenv versions
*
表示当前活动ruby
。测试:
ruby -v
这应该是您要的版本。
使用 rbenv
比系统 ruby 好很多,所以我希望它对你有用。
根据Github中的rbenv官方文档,它们的区别如下:
# Sets a local application-specific Ruby version
# by writing the version name to a `.ruby-version`.
$ rbenv local <version>
# Sets the global version of Ruby to be used in all shells
# by writing the version name to the `~/.rbenv/version` file
$ rbenv global <version>
# Sets a shell-specific Ruby version by setting the
# RBENV_VERSION environment variable in your shell.
# This for temporary use and will only work during the terminal session
$ rbenv shell <version>
请注意,您的终端会话将不再考虑任何 .ruby 版本文件。您需要 运行 rbenv shell --unset 再次启用自动切换。
快乐编码:)
// Start background info.
我只想在 rails 上安装 ruby 用于开发(OSX El Capitan)。
痛点:
ERROR: While executing gem ... (Gem::FilePermissionError) You don't have write permissions for the /Library/Ruby/Gems/2.0.0 directory.
解决方法:安装rbenv来管理/修改单独的ruby.
rbenv 当前正在使用我的系统 ruby - 所以我通过 rbenv install 下载了一个相同的版本。
// end background info.
实际问题:我是否将 rbenv 本地、全局或 shell ruby 版本设置为新下载的版本?
通常 rbenv
会为您做脏活累活 if loaded correctly,但如果您需要更改 global 设置,您可以随时更新它:
rbenv global 2.3.0
然后您可以检查应用是否正确:
rbenv versions
*
表示当前活动ruby
。测试:
ruby -v
这应该是您要的版本。
使用 rbenv
比系统 ruby 好很多,所以我希望它对你有用。
根据Github中的rbenv官方文档,它们的区别如下:
# Sets a local application-specific Ruby version
# by writing the version name to a `.ruby-version`.
$ rbenv local <version>
# Sets the global version of Ruby to be used in all shells
# by writing the version name to the `~/.rbenv/version` file
$ rbenv global <version>
# Sets a shell-specific Ruby version by setting the
# RBENV_VERSION environment variable in your shell.
# This for temporary use and will only work during the terminal session
$ rbenv shell <version>
请注意,您的终端会话将不再考虑任何 .ruby 版本文件。您需要 运行 rbenv shell --unset 再次启用自动切换。
快乐编码:)