2

The issue: I can no longer access my command history from previous Rails console sessions - history is only available for my current console session.

I'm on macOS Sierra (10.12.2). My last app was Rails 3.2 and Ruby 2.1.6 (installed via rvm), and when I fired up a console (using rails c command from terminal), pressing the up arrow on my keyboard let me access my history from previous console sessions.

My new app is Rails 5.0.1 and Ruby 2.4.0 (also installed using rvm). When I start the console in this app, pressing the up arrow doesn't recall any commands from before.

In my home folder, the .irbrc file looks like this:

require "awesome_print"
AwesomePrint.irb!
require 'irb/ext/save-history'

My intuition is this has something to do with rvm changing something up on me, since I can't really think of what else would have changed going between my old app and newer one.

Any idea why I can't retrieve old Rails console commands from my history?

Edit:

When I start the console it gives me the following messages:

Loading development environment (Rails 5.0.1)
Cannot read termcap database;
using dumb terminal settings.
DelPiero
  • 489
  • 1
  • 10
  • 21
  • The answer to your problem is the same as this one: http://stackoverflow.com/questions/37847822/irb-history-not-working-with-ruby-2-3-0 – user40376 May 02 '17 at 06:29

1 Answers1

1

You may need to uninstall readline and then reinstall before reinstalling ruby:

brew uninstall readline
brew install readline

You may further need to include --ignore-dependencies when uninstalling if another package depends on an old version of readline, e.g. postgresql in my case.

Tom
  • 4,257
  • 6
  • 33
  • 49
user40376
  • 11
  • 1