在 Mac OS 上 安装完 ruby 2.0.0 ,打开 irb 开始练习 Ruby ,但是发现没有Tab代码补全功能,google解决,方案如下
1、安装 bond 执行如下命令即可
sudo gem install bond
2、在当前用户根目录创建 .irbrc
vi ~/.irbrc
3、在文件中添加如下内容
require 'bond' Bond.start
4、保存关闭文件即可
再次打开 irb 就可以使用 tab 补全代码了
This is what worked for me on Mac OS 10.11.5. using rvm. Do the following :
sudo gem install bond
- Create the file
.irbrc
in your home directory.vi ~/.irbrc
-
Add the following lines in the
.irbrc
filerequire 'bond' Bond.start
-
Save and close the file
- Open
irb
and usetab
key to autocomplete