How can I clear the rails console history How can I clear the rails console history ruby ruby

How can I clear the rails console history


I interpret you question as asking how to turn history on in the Rails Console and off in the Ruby debugger. If this isn't true, please clarify.

IRB, and by extension, the Rails Console, read from ~/.irbrc, or if that doesn't exist, /etc/irbrc, to startup and configure irb. Your history is typically written to ~/.irb_history, but that is dictated by the contents of your irbrc file. The /etc/irbrc on my Mac OS X is set up to write the history from irb, so perhaps you've created a local .irbrc that doesn't have history, or perhaps you have a syntax error in that file.

The debugger reads a file called .rdebugrc on startup. You can turn off history in debug by adding this line to ~/.rdebugrc:

set history save off

Turn it back on with:

set history save on

You could also set your debug output to go to a different file than irb reads from with the command:

set history filename

These also work from the debug prompt, but aren't persistent.


There are a number of tools to help improve the irb experience. Bond and hirb are promising.

Here is Comprehensive list of Irb Tools and some tips on directly editing the .irbrc file.

Hope this help!


Although a very old question I got here by google.Turns out RVM slightly changed over time.Currently my IRB history (using rvm) is stored here:

user@host:~$ ls ~/.rvm/rubies/ruby-2.4.2/.irbrc*/home/user/.rvm/rubies/ruby-2.4.2/.irbrc/home/user/.rvm/rubies/ruby-2.4.2/.irbrc_history