irb history not working

quinn picture quinn · Jan 14, 2010 · Viewed 20.6k times · Source

in ~/.irbrc i have these lines:

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

and yet when i run irb and hit the up arrow nothing happens. also the irb history file specified is not getting created and nothing is logged to it.

Answer

Wayne Conrad picture Wayne Conrad · Jan 14, 2010

irb history works in Debian Linux out of the box. There's no etc/irbrc, nor do I have a ~/.irbrc. So, hmmmm.

This person put a bit more in his irbrc than you did. Do you suppose the ARGV.concat could be the missing piece?

require 'irb/completion'
require 'irb/ext/save-history'
ARGV.concat [ "--readline", "--prompt-mode", "simple" ]
IRB.conf[:SAVE_HISTORY] = 100
IRB.conf[:HISTORY_FILE] = "#{ENV['HOME']}/.irb-save-history"