Topic: irb and script console problems

Tried posting this on a different group, but apparently no one has ever experienced the problem there.  Worth a try here...

I've had a problem with irb and script/console since about mid-summer
and it's absolutely killing me.  In either environment, I'm unable to
use the spacebar.  It simply doesn't register.

After a recent reinstall of MySQL I also have the problem in the MySQL console.

I'm on OS X and I've tried using Terminal.app and iTerm and I see the same behavior.

Anyone ever had this problem before?  Solutions?  Is there even a remote chance that Apple phone support could help with such a thing in a timely manner?  (I don't have it at this time.)

~Barry Hess

Re: irb and script console problems

Apple phone support won't work.

Try to create a new user on your system and switch to that user and see if you have same problem. That will narrow it down to a global problem or a local problem.

You might also try switching shells to see if that does anything.

BJ Clark
the science department
http://www.scidept.com/

Re: irb and script console problems

Thanks for the reply, BJ!

Here's what I found.  Switching to csh, zsh, and tcsh all netted the same problem under irb.

Switching to my wife's login, using terminal, irb let me space away.

So it appears to be a user issue...

Re: irb and script console problems

Look in your home directory for invisible files:

ls -a ~/

There is likely a file in there (such as '.bash_profile') which is interpreted every time you open a terminal or irb session. I wouldn't think it would be shared between shells but you never know. If you see a file like that, try renaming it and opening a new terminal and see if you experience the same issues. This might help narrow it down anyway.

Railscasts - Free Ruby on Rails Screencasts

Re: irb and script console problems

Another good tip, Ryan!  I've isolated it down to my path export statement in ~/.bash_profile:

export PATH="/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:$PATH"

Straight out of Hivelogic - except he uses .bash_login, which never worked for me.

Specifically, if I remove the "/usr/local/bin" part my spacing works.  Doesn't make sense to me!

Last edited by bjhess (2007-10-12 22:28:48)

Re: irb and script console problems

bjhess wrote:

Another good tip, Ryan!  I've isolated it down to my path export statement in ~/.bash_profile:

export PATH="/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:$PATH"

Straight out of Hivelogic - except he uses .bash_login, which never worked for me.

Specifically, if I remove the "/usr/local/bin" part my spacing works.  Doesn't make sense to me!

Beats me.

BJ Clark
the science department
http://www.scidept.com/

Re: irb and script console problems

I suspect it's got to be my Ruby install.  With /usr/local/bin in my path:

theMacBook:~ bjhess$ which ruby
/usr/local/bin/ruby
theMacBook:~ bjhess$ ruby -v
ruby 1.8.6 (2007-03-13 patchlevel 0) [i686-darwin8.10.1]

theMacBook:~ bjhess$ which ruby
/usr/bin/ruby
theMacBook:~ bjhess$ ruby -v
ruby 1.8.2 (2004-12-25) [universal-darwin8.0]

This is probably obvious.  Anyway, I bet that's the difference.  I'll try to reinstall Ruby and see what happens.  MySQL will be a whole different thing, I suspect.

Re: irb and script console problems

Here's what I've tried so far.  Unless noted, when I say "install Ruby 1.8.x" I'm installing via the Hivelogic instructions.

o Reinstalled ruby-1.8.6.tar.gz
o Didn't help
o Installed ruby-1.8.6-p110.tar.gz
o Didn't help
o Installed ruby-1.8.5-p114.tar.gz
o Didn't help
o Installed via one-click installer (1.8.6, patchlevel 0 - just like Hivelogic)
o Didn't help

I don't know if this is a valid thing to do, but I copied /usr/bin/ruby (the 1.8.2 OS X default version) to /usr/local/bin/ruby and my space bar issues were resolved.  Obviously I'd like to have a more recent version of Ruby in place to avoid any conflicts.

So then:

o Installed ruby-1.8.2.tar.gz
o Didn't help

So then I got things back to Ruby 1.8.6 via the Hivelogic instructions.  Copied /usr/bin/irb (the default OS X path) to /usr/local/bin/irb.  Now things work.  The default OS X irb is version 0.9.  The "latest" version I was using is 0.9.5.

I don't think copying irb over is really the fix, naturally.  And I'm not really sure how to upgrade just irb.  I figured that should be replaced with each of the manual installs I completed above.

Last edited by bjhess (2007-10-14 23:53:38)

Re: irb and script console problems

More things I've tried:

o Copied default OS X /usr/bin/irb to /usr/local/bin/
- spacing worked
- script/console failed
- command history and left and right arrow didn't work - probably readline issue
- seems like a bad idea generally

o Reverted back and called "irb --noreadline"
- spacing worked
- again, no command history or left or right arrows
- readline problem, then?

o Upgraded readline to 5.2
o Reinstalled Ruby 1.8.6
- spacing still doesn't work in this "proper" environment.

Re: irb and script console problems

My "fix" is in.

I wasn't entirely sure how to uninstall the readline stuff I brought in via the Hivelogic instructions.  Tooling around in my system, removed the following folders and files:

o /usr/local/include/readline
o /usr/local/lib/ruby/1.8/i686-darwin8.10.1/readline.bundle
o /usr/local/lib/ruby/1.8/i686-darwin8.8.3/readline.bundle

Then I reinstalled Ruby from the source already on my system:

o cd /usr/local/src/ruby-1.8.6
o make distclean
o ./configure --prefix=/usr/local --enable-pthread --enable-shared
o make
o sudo make install

Notice in the ./configure line I did not include the "--with-readline-dir=/usr/local" switch.

So I imagine this sends me back to the OS X system default readline.  So _technically_ I don't have control over all stuff that's being used in my coding environment.  But I think I'll leave it be for now.  Readline is low-impact, and it really seems unlikely that I'll be needing the latest and greatest version anytime soon.