Wednesday, April 22, 2015

irb history

I installed ruby 2.2.1 using rbenv on Mac OS 10.10.3. By default the irb console does not save the history, so you cannot use the saved code in the history by using the arrows in new irb sessions. To fix this problem, create ~/.irbrc and add this code:

require 'irb/ext/save-history'
#History configuration
IRB.conf[:SAVE_HISTORY] = 1000
IRB.conf[:HISTORY_FILE] = "#{ENV['HOME']}/.irb-save-history"