# Sh: irb: command not found error

**URL:** <https://www.ruby-forum.com/t/sh-irb-command-not-found-error/187904>\
**Category:** Rails\
**Created:** [May 1, 2010, 1:04pm UTC](https://www.ruby-forum.com/t/sh-irb-command-not-found-error/187904 "2010-05-01T13:04:54Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![toulon](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/4af34b/32.png) [@toulon](https://www.ruby-forum.com/u/toulon)\
**Post date:** [May 1, 2010, 1:04pm UTC](https://www.ruby-forum.com/t/sh-irb-command-not-found-error/187904/1 "2010-05-01T13:04:54Z")

</div>

I am running ruby 1.8.6 and rails 2.3.5 and just started learning  
rails

When following the tutorial on

> **[Getting Started with Rails — Ruby on Rails Guides](https://guides.rubyonrails.org/getting_started.html)**
>
> Getting Started with RailsThis guide covers getting up and running with Ruby on Rails.After reading this guide, you will know: How to install Rails, create a new Rails application, and connect your application to a database. The general layout of a...

I tried to run the command script/console and it failed. After some  
research I found the following solution.

I am posting this as my google search did not turn up any useful on my  
initial scan

Anyway here goes for what it is worth

$ script/console  
Loading development environment (Rails 2.3.5)  
sh: irb: command not found

How to recompile ruby with readline support - this solves the irb  
issue above

1. Install readline to /usr/local
2. Recompile ruby from scratch and use the --with-readline-dir=/usr/  
local switch

or if you have downloaded the ruby sources earlier and built it by  
hand,

1. Go to the ext/readline folder of your ruby source tree
2. Type ruby extconf.rb and then run the make && make install  
procedure for ruby.

See example below

mfnit1 blog $ cd /usr/src/ruby-1.8.6/ext/readline/  
mfnit1 readline $ ls  
depend extconf.rb Makefile mkmf.log readline.c readline.o  
README README.ja  
mfnit1 readline $ ruby extconf.rb  
checking for tgetnum() in -lncurses… yes  
checking for readline/readline.h… yes  
checking for readline/history.h… yes  
checking for readline() in -lreadline… yes  
checking for rl\_filename\_completion\_function in stdio.h,readline/  
readline.h,readline/history.h… yes  
checking for rl\_username\_completion\_function in stdio.h,readline/  
readline.h,readline/history.h… yes  
checking for rl\_completion\_matches in stdio.h,readline/  
readline.h,readline/history.h… yes  
checking for rl\_deprep\_term\_function in stdio.h,readline/  
readline.h,readline/history.h… yes  
checking for rl\_completion\_append\_character in stdio.h,readline/  
readline.h,readline/history.h… yes  
checking for rl\_basic\_word\_break\_characters in stdio.h,readline/  
readline.h,readline/history.h… yes  
checking for rl\_completer\_word\_break\_characters in stdio.h,readline/  
readline.h,readline/history.h… yes  
checking for rl\_basic\_quote\_characters in stdio.h,readline/  
readline.h,readline/history.h… yes  
checking for rl\_completer\_quote\_characters in stdio.h,readline/  
readline.h,readline/history.h… yes  
checking for rl\_filename\_quote\_characters in stdio.h,readline/  
readline.h,readline/history.h… yes  
checking for rl\_attempted\_completion\_over in stdio.h,readline/  
readline.h,readline/history.h… yes  
checking for rl\_library\_version in stdio.h,readline/  
readline.h,readline/history.h… yes  
checking for rl\_event\_hook in stdio.h,readline/readline.h,readline/  
history.h… yes  
checking for rl\_cleanup\_after\_signal()… yes  
checking for rl\_clear\_signals()… yes  
checking for rl\_vi\_editing\_mode()… yes  
checking for rl\_emacs\_editing\_mode()… yes  
checking for rl\_clear\_signals()… yes  
checking for replace\_history\_entry()… yes  
checking for remove\_history()… yes  
creating Makefile  
$ cd /usr/src/ruby-1.8.6  
$ make  
$ make install

Test of script/console  
mfnit1 ruby-1.8.6 $ cd /var/www/html/blog/  
mfnit1 blog $ script/console  
Loading development environment (Rails 2.3.5)
