readline snippets

Solution to "require': no such file to load -- readline (LoadError)" problem

Tagged readline, ruby, console, compile  Languages bash

If you've compiled Ruby from source, you might get this error when executing script/console:

/usr/local/lib/ruby/1.8/irb/completion.rb:10:in require': no such file to load -- readline (LoadError)

One way of fixing this is to compile readline, which is distributed along with the Ruby source:

cd /opt/src/ruby-1.8.5-p2/ext/readline
ruby extconf.rb
make
sudo make install

This works even after compiling Ruby, so no need to recompile... If you're wondering what readline is then this quote from the project homepage sums it up in one sentence: "The GNU Readline library provides a set of functions for use by applications that allow users to edit command lines as they are typed in."

Compiling Ruby with OpenSSL, Zlib and Readline support on Debian

Tagged ruby, readline, ssl, zlib, debian  Languages ruby

DRAFT... From http://blog.fiveruns.com/2008/3/3/compiling-ruby-rubygems-and-rails-on-ubuntu

Install pre-requisites

apt-get -y install build-essential libssl-dev libreadline5-dev zlib1g-dev

Download and install

cd /usr/local/src

wget http://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.6.tar.gz

tar zxvf ruby-1.8.6.tar.gz

cd ruby-1.8.6.tar.gz

./configure --prefix=/usr/local --with-openssl-dir=/usr --with-readline-dir=/usr --with-zlib-dir=/usr

make
make install

ruby -ropenssl -rzlib -rreadline -e "puts :success"

How to fix the iTerm keyboard bindings in OSX (readline configuration)

Tagged zsh, readline, keyboard, shortcuts  Languages bash

The keyboard bindings in iTerm on OSX Snow Leopard are fubar. To fix them either switch to Linux or put this in your zsh configuration:

bindkey "^r" history-incremental-search-backward
bindkey '^E' end-of-line
bindkey '^A' beginning-of-line
bindkey 'ƒ'  forward-word
bindkey '›'  backward-word
bindkey "^F" forward-char
bindkey "^B" backward-char
bindkey "^k" kill-line
bindkey "^u" backward-kill-line

Fix: Library not loaded: /opt/local/lib/libreadline.6.dylib

Tagged readline, ruby, fuckup  Languages bash

If you get this error:

% script/console
Loading development environment (Rails 2.3.4)
/Library/Ruby/Site/1.8/universal-darwin10.0/readline.bundle: dlopen(/Library/Ruby/Site/1.8/universal-darwin10.0/readline.bundle, 9): Library not loaded: /opt/local/lib/libreadline.6.dylib (LoadError)
  Referenced from: /Library/Ruby/Site/1.8/universal-darwin10.0/readline.bundle
  Reason: image not found - /Library/Ruby/Site/1.8/universal-darwin10.0/readline.bundle
        from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/irb/completion.rb:10
        from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/irb/init.rb:253:in require'
        from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/irb/init.rb:253:in load_modules'
        from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/irb/init.rb:251:in each'
        from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/irb/init.rb:251:in load_modules'
        from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/irb/init.rb:21:in setup'
        from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/irb.rb:54:in start'
        from /usr/bin/irb:13

then this might help:

mv /Library/Ruby/Site/1.8/universal-darwin10.0/readline.bundle /tmp

If not move it back. I got the error after having used and uninstalled MacPorts. Using Homebrew now...