sh: irb: command not found error

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 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)