How To – Persist Rails or IRB Console Command History After Exit
Sick of not having Ubuntu rails or irb terminal not saving your command history after exiting the console? Try this little trick to fix it up!
Append into your ~/.irbrc the following
require ‘irb/ext/save-history’
IRB.conf[:SAVE_HISTORY] = 200
IRB.conf[:HISTORY_FILE] = “#{ENV['HOME']}/.irb-history”
require ‘irb/ext/save-history’IRB.conf[:SAVE_HISTORY] = 200IRB.conf[:HISTORY_FILE] = “#{ENV['HOME']}/.irb-history”
IRB.conf[:SAVE_HISTORY] = 200
IRB.conf[:HISTORY_FILE] = “#{ENV['HOME']}/.irb-history”
require ‘irb/ext/save-history’IRB.conf[:SAVE_HISTORY] = 200IRB.conf[:HISTORY_FILE] = “#{ENV['HOME']}/.irb-history”
You will notice the extra bit at the top of my ~/.irbrc, that makes sure that SQL is outputted as I type commands. Good for debugging.
Now enjoy your rails history!
Related Posts
Posted on September 14, 2010 at 11:46 am by Jordan Carter · Permalink
In: How To, Ruby on Rails, Ubuntu Tricks · Tagged with: console, irb, ruby on rails, Ubuntu
In: How To, Ruby on Rails, Ubuntu Tricks · Tagged with: console, irb, ruby on rails, Ubuntu



on October 23, 2010 at 6:21 am
Permalink
Thanks much for this! Saved me tremendous pain.
on October 29, 2010 at 11:37 am
Permalink
THANK YOU
on September 7, 2012 at 9:28 pm
Permalink
You’ve got the same bit of code copied twice there, and it has webby quotes. Took me a minute to figure out what was going wrong