rbenv使用
Mac下安装
在参考官方文档 https://github.com/rbenv/rbenv 的时候要注意:
$ echo 'eval "$(rbenv init -)"' >> ~/.bash_profile
这一行要执行下,否则$ rbenv shell
会报错.
rbenv-gemset
https://github.com/jf/rbenv-gemset
- 默认的gems可能是安装在
~/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems
.
如果系统已经存在某个gem,可能就不会安装到指定的目录了.这时可以gem uninstall --all
全部删除(看下~/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems
下是不是基本上空了?)
然后再bundle install
,这时看看gems是不是都安装到~/.rbenv/versions/2.2.3/gemsets/your_gemset_name
下了?
-
如果相要指定gemset下删除某个gem,可以用
$ RBENV_GEMSETS="-global" gem uninstall puma
-
$ rbenv gemset active
可以用于查看当前目录下有哪些gemset被使用到。
RubyMine8
RubyMine8.0开始支持rbenv-gemset了,不过目前RubyMine有个bug,就是在你通过Preferences => Ruby SDK and gems
改动时,会把所有的在同一个windows中的用到rbenv-gemset的项目的配置都改成一样的.rbenv-gemsets的定义,避免这个问题的办法是不同的Ruby项目在不同的window中打开.
常用命令
rbenv
rbenv-gemset
Relative articles
https://github.com/rbenv/rbenv/wiki/Understanding-binstubs