我已使用export RUBYLIB=<path>/gem/lib
来对本地计算机上的Ruby gem进行调整。我不了解它实际发生了什么变化。我有一个打开一些终端标签的脚本,如果我想使用调整后的 gem ,我必须事先这样做。
我可以只做一次export RUBYLIB=<path>/gem/lib
,而不必再次做一次吗?它实际上是做什么的?
最佳答案
从ruby-doc,
RUBYLIB - Additional search path for Ruby programs ($SAFE must be 0).
即
The list of paths mentioned here will be added to the list of paths Ruby uses to search for libraries included in the program with the require method. The paths in RUBYLIB will be searched before other directories
。要一次性完成,请将
export RUBYLIB=/gem/lib
附加到/etc/bash.bashrc
或~/.bashrc
。