Skip to content

Instantly share code, notes, and snippets.

@justinxreese
Last active June 29, 2017 20:36
Show Gist options
  • Save justinxreese/332bd9325134708e3e4ea42206d8462d to your computer and use it in GitHub Desktop.
Save justinxreese/332bd9325134708e3e4ea42206d8462d to your computer and use it in GitHub Desktop.
Ruby readline characters
➜ rails c
irb(main):001:0> test = 1
=> 1
irb(main):002:0> ^[[A^C
irb(main):002:0> ^D
➜ ruby -v
ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-darwin16]
➜ irb -v
irb 0.9.6(09/06/30)
➜ sw_vers
ProductName: Mac OS X
ProductVersion: 10.12.1
BuildVersion: 16B2548a
➜ ruby -r rbconfig -e 'puts RbConfig::CONFIG["configure_args"]'
'--prefix=/Users/justin/.rubies/ruby-2.3.1' '--with-opt-dir=/usr/local/opt/openssl:/usr/local/opt/readline:/usr/local/opt/libyaml:/usr/local/opt/gdbm'
@justinxreese
Copy link
Author

justinxreese commented Jun 29, 2017

For months now, I've had an issue where any ruby console doesn't let me use the arrow keys for navigating anymore.

Here you see I start a rails console, type an example bit of code, try to use the up arrow to change that bit of code, but instead of it placing the most recent line on the prompt, it places ^[[A. I then must use ^C to get a new line and then, in this example I used ^D to exit the prompt but I could have just continued on with whatever I was doing.

I've tried

  • uninstalling and reinstalling readline through homebrew
  • re-compiling ruby before and after doing that
  • uninstalling the rb-readline gem
  • switching to bash from zsh

@StabbyCutyou
Copy link

ruby 2.3.1p112

I thought ruby did away with patch levels once they moved to 2.0+?

@justinxreese
Copy link
Author

justinxreese commented Jun 29, 2017

@StabbyCutyou I must be on the bootleg rubies

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment