Readline not working with Ruby

Hey I compiled ruby with readline support. However when i go to IRB i
just get jibbrish when i press the up arrow on my keyboard. Any
suggestions?

Stewart wrote:

Hey I compiled ruby with readline support. However when i go to IRB i
just get jibbrish when i press the up arrow on my keyboard. Any
suggestions?

No suggestions, but I have this problem too:

irb
irb(main):001:0> puts “Test”
Test
=> nil
irb(main):002:0> ^[[A

ruby -v: ruby 1.9.1p243 (2009-07-16 revision 24175) [i686-linux]

Marvin

Stewart [email protected] writes:

Hey I compiled ruby with readline support. However when i go to IRB i
just get jibbrish when i press the up arrow on my keyboard. Any
suggestions?

Identify the terminal (emulator) that you use and set the TERM
environment variable correctly.

If you change it, use tset to reset the terminal.

Launch irb. readline should use the TERM environment variable to
parse the right control codes from the terminal keyboard and send the
right control codes to the terminal screen.

On Aug 11, 4:22 pm, [email protected] (Pascal J. Bourguignon)
wrote:

Launch irb. readline should use the TERM environment variable to
parse the right control codes from the terminal keyboard and send the
right control codes to the terminal screen.


Pascal B.

Not sure what you mean by “terminal (emulator)” could you explain in a
little more detail what you mean.

2009/8/11 Stewart [email protected]

Hey I compiled ruby with readline support. However when i go to IRB i
just get jibbrish when i press the up arrow on my keyboard. Any
suggestions?

i had the same problem. going to the ext/readline directory and ‘make’
and
‘make install’ solved the problem for me.

-Thomas


Thomas P.
[email protected]
http://thopre.googlepages.com/

Ogden Nash http://www.brainyquote.com/quotes/authors/o/ogden_nash.html

“The trouble with a kitten is that when it grows up, it’s always a cat.”

On Aug 11, 4:27 pm, Brian C. [email protected] wrote:

If that’s not the problem, then you’ll need to be more specific. What OS
are you on? What version of ruby are you building? What makes you think
you built readline support successfully? Look through
ext/readline/mkmf.log to see why the extension wasn’t built, and post it
here if you don’t understand it.

Posted viahttp://www.ruby-forum.com/.

Sorry I should have posted more info

ruby 1.8.7 (2008-08-11 patchlevel 72) [i686-darwin9.6.0]

on mac os 10.5

I downloaded readline and compiled it my self. Then i compiled ruby.
So I would suggest its there and working but I am not sure. I think it
might be a linkage issue. Where can i find ext/readline/mkmf.log ?

On Tue, Aug 11, 2009 at 5:53 PM, Thomas P.[email protected]
wrote:

And I recompiled everything after having installed libreadline5-dev.
Well I guess this is safer and that is what make is for after all.
Brian: I would only rerun ./configure if really necessary because that
recompiles everything, but that at least is the bullet proof method
;).
Cheers
Robert

Stewart wrote:

ruby 1.8.7 (2008-08-11 patchlevel 72) [i686-darwin9.6.0]

on mac os 10.5

I downloaded readline and compiled it my self. Then i compiled ruby.
So I would suggest its there and working but I am not sure.

Did you install readline after compiling it? I imagine that ruby
couldn’t find wherever readline decided to install its header files.

Say if those files went into /usr/local/include, then you could try
setting

export CPPFLAGS="-I/usr/local/include -L/usr/local/lib"

before running ./configure

I think it
might be a linkage issue. Where can i find ext/readline/mkmf.log ?

cd /the/source/directory/where/you/built/ruby
cd ext/readline
ls
cat mkmf.log

/usr/local/src/ruby-1.8.7-p72/ext/readline $ make
make: Nothing to be done for all'. /usr/local/src/ruby-1.8.7-p72/ext/readline $ make install make: Nothing to be done forinstall’.
/usr/local/src/ruby-1.8.7-p72/ext/readline $ ls
Makefile README README.ja depend extconf.rb readline.bundle
readline.c readline.o
/usr/local/src/ruby-1.8.7-p72/ext/readline $

Did not do anything Does not seem anything was made.

Stewart wrote:

Hey I compiled ruby with readline support. However when i go to IRB i
just get jibbrish when i press the up arrow on my keyboard. Any
suggestions?

You need the readline development libraries installed at the time when
you run ./configure. If you’re under Linux, the package will be called
something like libreadline5-dev (Ubuntu/Debian) or readline-devel
(RedHat or other RPM-based distro)

If that’s not the problem, then you’ll need to be more specific. What OS
are you on? What version of ruby are you building? What makes you think
you built readline support successfully? Look through
ext/readline/mkmf.log to see why the extension wasn’t built, and post it
here if you don’t understand it.

Marvin Gülker [email protected] writes:

=> nil
irb(main):002:0> ^[[A

ruby -v: ruby 1.9.1p243 (2009-07-16 revision 24175) [i686-linux]

type in the shell:

echo $TERM

and compare with the actual terminal (or terminal emulator) that you are
using.

Stewart [email protected] writes:

If you change it, use tset to reset the terminal.

Launch irb. readline should use the TERM environment variable to
parse the right control codes from the terminal keyboard and send the
right control codes to the terminal screen.

Not sure what you mean by “terminal (emulator)” could you explain in a
little more detail what you mean.

http://en.wikipedia.org/wiki/Computer_terminal
http://tldp.org/HOWTO/Text-Terminal-HOWTO.html

You would use readline only when you’re using the program thru a text
terminal interface. (eg. if you use irb thru emacs run-ruby command,
then you don’t need readline because you have emacs editing commands
instead).

Nowadays, the most probable is that you are actually using a terminal
emulator, that takes input from your console keyboard and displays
output in a GUI window, but still communicating with the application
thru the serial I/O device drivers like a terminal. You still have
all the constraints of a terminal, including that of knowing exactly
what control codes are sent over the serial channel to represent key
presses, and what control codes are sent to the screen to control it
(cursor movement, character decorations, character displayed, etc).

On Tue, Aug 11, 2009 at 6:05 PM, Pascal J.
Bourguignon[email protected] wrote:

irb(main):001:0> puts “Test”
and compare with the actual terminal (or terminal emulator) that you are using.


Pascal B.

I strongly suggest to check if your readline extension really compiled
before explorating the unlikely path of terminal issues
type

ruby -rreadline -e 'p 42"

and only if that works explore Pascal’s idea.
HTH
Robert

On Aug 11, 2009, at 10:55 AM, Stewart wrote:

called
here if you don’t understand it.

Posted viahttp://www.ruby-forum.com/.

Sorry I should have posted more info

ruby 1.8.7 (2008-08-11 patchlevel 72) [i686-darwin9.6.0]

on mac os 10.5

I’m pretty sure it’s not even needed on Mac OS 10.5, as it ships with
libedit for a compatible replacement. It won’t hurt anything though,
of course.

What happens if you start irb like this?

irb --readline

James Edward G. II

Stewart [email protected] writes:

ruby 1.8.7 (2008-08-11 patchlevel 72) [i686-darwin9.6.0]

on mac os 10.5

This is not enough information. What terminal emulator do you use?
Is it Terminal.app? Is it AquaTerm.app? Is it another MacOSX
application?
Is it an xterm in X11.app? or some other X terminal emulator?
Or do you use a Linux console or another X terminal emulator running
on Linux, and connect to MacOSX thru ssh?

On Aug 11, 5:05 pm, James G. [email protected] wrote:

think

James Edward G. II
/usr/local/src/ruby-1.8.7-p72/ext/readline $ irb --readline
irb(main):001:0>

On Aug 11, 5:04 pm, [email protected] (Pascal J. Bourguignon)
wrote:

Test


Pascal B.

Ah ok. I see I am using ASCI or that is what my term value is set to.
I am using a macbook so i am just using the default terminal for the
mac. How do i know what hte correct value of term is?

On Aug 11, 5:09Â pm, Robert D. [email protected] wrote:

suggestions?

before explorating the unlikely path of terminal issues
 alias_method :λ, :lambda
end

/usr/local/src/ruby-1.8.7-p72/ext/readline $ ruby -rreadline -e ‘p 42’
/usr/local/ruby_test/lib/ruby/site_ruby/1.8/i686-darwin9.6.0/
readline.bundle: dlopen(/usr/local/ruby_test/lib/ruby/site_ruby/1.8/
i686-darwin9.6.0/readline.bundle, 9): Symbol not found:
_rl_filename_completion_function (LoadError)
Referenced from: /usr/local/ruby_test/lib/ruby/site_ruby/1.8/i686-
darwin9.6.0/readline.bundle
Expected in: flat namespace

  • /usr/local/ruby_test/lib/ruby/site_ruby/1.8/i686-darwin9.6.0/
    readline.bundle

On Aug 11, 4:59 pm, Brian C. [email protected] wrote:

cd /the/source/directory/where/you/built/ruby
cd ext/readline
ls
cat mkmf.log

Posted viahttp://www.ruby-forum.com/.

There is no mkmf.log file in that directory. When you say
run .configure do you mean in the base src folder where i downloaded
ruby?

On Aug 11, 2009, at 11:15 AM, Stewart wrote:

suggestions?
are you on? What version of ruby are you building? What makes you
ruby 1.8.7 (2008-08-11 patchlevel 72) [i686-darwin9.6.0]

James Edward G. II

/usr/local/src/ruby-1.8.7-p72/ext/readline $ irb --readline
irb(main):001:0>

And do the editing keys now work as expected?

James Edward G. II

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs