How do I get irb to use readline, (with OS X)?

Are you talking about completion, which uses readline?

alias irb ‘irb -r irb/completion’

···

On Monday, 17 March 2003 at 5:38:45 +0900, Sam Roberts wrote:

I’m sure I saw something about this somewhere, but I’ve been searching,
and haven’t found it again.

Has anybody done this? Will I have to recompile ruby?


Jim Freeze

The camel has a single hump;
The dromedary two;
Or else the other way around.
I’m never sure. Are you?
– Ogden Nash

Sorry for being vague. What I want is simpler that that - I want to be able to
use the arrow keys (or even ^p) to go back through the history, and to move
back through a line and edit it!

I can’t use any line editing keys right now, its getting irritating!

Completion, I think, allows TAB to complete the names of methods, correct?

[ensemble] ~/p/ruby/vcard $ irb -r irb/completion
/usr/lib/ruby/1.6/irb/completion.rb:10:in require': No such file to load -- readline (LoadError) from /usr/lib/ruby/1.6/irb/completion.rb:10 from /usr/lib/ruby/1.6/irb/init.rb:197:in require’
from /usr/lib/ruby/1.6/irb/init.rb:197:in load_modules' from /usr/lib/ruby/1.6/irb/init.rb:195:in each’
from /usr/lib/ruby/1.6/irb/init.rb:195:in load_modules' from /usr/lib/ruby/1.6/irb.rb:52:in start’
from /usr/bin/irb:13

ext/readline is supposed to be part of ruby, isn’t it?

I also can’t see a /usr/lib/libreadline*, so I really think I’m missing something!

Cheers,
Sam

Quoteing jim@freeze.org, on Mon, Mar 17, 2003 at 10:21:45PM +0900:

···

On Monday, 17 March 2003 at 5:38:45 +0900, Sam Roberts wrote:

I’m sure I saw something about this somewhere, but I’ve been searching,
and haven’t found it again.

Has anybody done this? Will I have to recompile ruby?

Are you talking about completion, which uses readline?

alias irb ‘irb -r irb/completion’


Jim Freeze

The camel has a single hump;
The dromedary two;
Or else the other way around.
I’m never sure. Are you?
– Ogden Nash

ext/readline is supposed to be part of ruby, isn't it?

yes if ruby can find libreadline

I also can't see a /usr/lib/libreadline*, so I really think I'm missing
something!

Well, you can perhaps take a look at

   http://www.rubygarden.org/ruby?RubyOnMacintosh

   building 1.6.8 on os x with readline, gdbm, tcltk, x11

Guy Decoux

Does OSX have ‘bash’ with readline? If so try
ldd which bash

which will show you if where your libreadline is (if you have it as a
dynamic library, and bash was linked against it)

But if irb doesn’t use readline by default, then I imagine that ruby didn’t
find readline when it was compiled, which means recompiling ruby, or at
least ext/readline/

Regards,

Brian.

···

On Tue, Mar 18, 2003 at 12:42:58AM +0900, Sam Roberts wrote:

Sorry for being vague. What I want is simpler that that - I want to be able to
use the arrow keys (or even ^p) to go back through the history, and to move
back through a line and edit it!

I can’t use any line editing keys right now, its getting irritating!

Sorry for being vague. What I want is simpler that that - I want to be able to
use the arrow keys (or even ^p) to go back through the history, and to move
back through a line and edit it!

I can’t use any line editing keys right now, its getting irritating!

Completion, I think, allows TAB to complete the names of methods, correct?

[ensemble] ~/p/ruby/vcard $ irb -r irb/completion
/usr/lib/ruby/1.6/irb/completion.rb:10:in require': No such file to load -- readline (LoadError) from /usr/lib/ruby/1.6/irb/completion.rb:10 from /usr/lib/ruby/1.6/irb/init.rb:197:in require’
from /usr/lib/ruby/1.6/irb/init.rb:197:in load_modules' from /usr/lib/ruby/1.6/irb/init.rb:195:in each’
from /usr/lib/ruby/1.6/irb/init.rb:195:in load_modules' from /usr/lib/ruby/1.6/irb.rb:52:in start’
from /usr/bin/irb:13

ext/readline is supposed to be part of ruby, isn’t it?

I also can’t see a /usr/lib/libreadline*, so I really think I’m
missing something!

Cheers,
Sam

I believe that the ruby included with Mac OS X 10.2 wasn’t built with
readline support. A sad omission. It means you need to recompile
with readline built in.

···

At 0:42 +0900 3/18/03, Sam Roberts wrote:

Quoteing jim@freeze.org, on Mon, Mar 17, 2003 at 10:21:45PM +0900:

On Monday, 17 March 2003 at 5:38:45 +0900, Sam Roberts wrote:

I’m sure I saw something about this somewhere, but I’ve been searching,
and haven’t found it again.

Has anybody done this? Will I have to recompile ruby?

Are you talking about completion, which uses readline?

alias irb ‘irb -r irb/completion’


Jim Freeze

The camel has a single hump;
The dromedary two;
Or else the other way around.
I’m never sure. Are you?
– Ogden Nash

Sorry for being vague. What I want is simpler that that - I want to be able to
use the arrow keys (or even ^p) to go back through the history, and to move
back through a line and edit it!

I can’t use any line editing keys right now, its getting irritating!

Completion, I think, allows TAB to complete the names of methods, correct?

Yes

[ensemble] ~/p/ruby/vcard $ irb -r irb/completion
/usr/lib/ruby/1.6/irb/completion.rb:10:in require': No such file to load -- readline (LoadError) from /usr/lib/ruby/1.6/irb/completion.rb:10 from /usr/lib/ruby/1.6/irb/init.rb:197:in require’
from /usr/lib/ruby/1.6/irb/init.rb:197:in load_modules' from /usr/lib/ruby/1.6/irb/init.rb:195:in each’
from /usr/lib/ruby/1.6/irb/init.rb:195:in load_modules' from /usr/lib/ruby/1.6/irb.rb:52:in start’
from /usr/bin/irb:13

ext/readline is supposed to be part of ruby, isn’t it?

The readline extension is, but not readline itself.
I think what you are missing is just the readline.so.

irb
irb(main):001:0> $"
=> [“irb.rb”, “e2mmap.rb”, “irb/init.rb”, “irb/context.rb”,
“irb/workspace.rb”, “irb/extend-command.rb”,
“irb/ruby-lex.rb”, “irb/slex.rb”, “irb/ruby-token.rb”,
“irb/input-method.rb”, “readline.so”, “irb/locale.rb”,
“kconv.rb”, “nkf.so”, “tempfile.rb”, “delegate.rb”,
“irb/completion.rb”]

IIRC, once you get readline up and running, you can set the mode in
.inputrc

cat .inputrc
set editing-mode vi

···

On Tuesday, 18 March 2003 at 0:42:58 +0900, Sam Roberts wrote:


Jim Freeze

Save the whales. Collect the whole set.

May be this should go into a new thread, but
I have the same problem with Win95 and Ruby/mswin32:

Under cygwin environment, irb --readline
works fine, but the mswin32 binary
(found at http://www.dm4lab.to/~usa/ruby/index_en.html)
does not include it.

Just removed Cygwin because all I need is Ruby (I thought) ;-(

Norbert

Quoteing B.Candler@pobox.com, on Tue, Mar 18, 2003 at 01:29:38AM +0900:

···

On Tue, Mar 18, 2003 at 12:42:58AM +0900, Sam Roberts wrote:

Sorry for being vague. What I want is simpler that that - I want to be able to
use the arrow keys (or even ^p) to go back through the history, and to move
back through a line and edit it!

I can’t use any line editing keys right now, its getting irritating!

Does OSX have ‘bash’ with readline? If so try
ldd which bash

Yes to bash with readline, no to ‘ldd’!

It looks like I have to rebuild.

Thanks,
Sam

Hi,

···

At Wed, 19 Mar 2003 17:53:37 +0900, Norbert Gawor wrote:

Under cygwin environment, irb --readline
works fine, but the mswin32 binary
(found at http://www.dm4lab.to/~usa/ruby/index_en.html)
does not include it.

Do you mean mswin32 ruby works with cygwin readline library?


Nobu Nakada

No, let me try to clarify:
a) my first installation was cygwin.tar.gz + the Cygwin DLL
(probably from http://www.os.rim.or.jp/~eban/ - I don’t
have it here in my office)

Here the cursor keys worked with irb.

b) I installed the Ruby/mswin32 binary, including irb,
and was somehow disappointed because cursor keys
did not work. I just would like to know how
(any) readline library could be used with Ruby/mswin32

  • or has it been intentionally left out?

regards, Norbert

···

nobu.nokada@softhome.net wrote:

Do you mean mswin32 ruby works with cygwin readline library?

Hi,

···

At Thu, 20 Mar 2003 16:56:29 +0900, Norbert Gawor wrote:

b) I installed the Ruby/mswin32 binary, including irb,
and was somehow disappointed because cursor keys
did not work. I just would like to know how
(any) readline library could be used with Ruby/mswin32

  • or has it been intentionally left out?

Sorry, I don’t know readline library for native Windows.


Nobu Nakada