[英]System-wide RVM to replace a home directory loaded on different architectures
I saw some questions like this already, but it seems that system-wide RVM has been deprecated, so none of the answers apply.我已经看到了一些这样的问题,但似乎系统范围的 RVM 已被弃用,因此没有任何答案适用。
I have an NFS-mounted home directory which is accessible to me when I login to any number of different machines in our lab.我有一个 NFS 挂载的主目录,当我登录到我们实验室中任意数量的不同机器时,我可以访问它。 As such, a locally-compiled Ruby will break when I try to use it on these different machines -- as they have different architectures.
因此,当我尝试在这些不同的机器上使用本地编译的 Ruby 时,它会中断——因为它们具有不同的架构。
I installed RVM as superuser, but I can't figure out how to direct my regular user account to use the superuser-selected Ruby.我以超级用户身份安装了 RVM,但我不知道如何指导我的常规用户帐户使用超级用户选择的 Ruby。 Instead it always tries to use the one in
~/bin
.相反,它总是尝试使用
~/bin
中的那个。
What is the appropriate way to select the global Ruby? select 全局 Ruby 的合适方法是什么?
I struggled with this same issue for quite a while.我在同样的问题上挣扎了很长一段时间。 I ended up doing the following:
我最终做了以下事情:
Install rvm with the following command line (note: the --path option is not mentioned in the usage, so I don't know how supported it is, but it worked for me), with the appropriate architecture in the path:使用以下命令行安装 rvm(注意:使用中没有提到 --path 选项,所以我不知道它的支持程度,但它对我有用),路径中有适当的架构:
rvm-installer --path ~/tools/x86_64/rvm --version latest
Install for whatever architectures you want to be able to support.安装您希望能够支持的任何架构。 (note: make sure you don't have a.rvmrc file overriding the path, especially during the second install.)
(注意:确保您没有覆盖路径的 .rvmrc 文件,尤其是在第二次安装期间。)
Then add the following to your.bashrc/.bash_profile:然后将以下内容添加到 your.bashrc/.bash_profile:
OS=$(uname -s)
if [[ $OS = Linux ]] ; then
> ARCH=$(uname -m | sed 's/i.86/i686/')
elif [[ $OS = FreeBSD ]] ; then
> ARCH=$(uname -m | sed 's/i.86/i686/')
elif [[ $OS = Darwin ]] ; then
> ARCH=mac
else
> ARCH=unknown
fi
export ARCH
There will be a line added by the installer in your.bash_profile that sets up the rvm function, change it to look like this:安装程序将在 your.bash_profile 中添加一行设置 rvm function,将其更改为如下所示:
[[ -s "$HOME/tools/$ARCH/rvm/scripts/rvm" ]] && . "$HOME/tools/$ARCH/rvm/scripts/rvm"
You should also edit your.rvmrc file to have the following:您还应该编辑您的 .rvmrc 文件以具有以下内容:
export rvm_path="$HOME/tools/$ARCH/rvm"
I haven't had time to fully test out this setup, but at least it appears to be invoking the correct version of RVM on the different platforms.我还没有时间完全测试这个设置,但至少它似乎在不同平台上调用了正确版本的 RVM。
Good luck!祝你好运!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.