4

What the difference is between the .irb-history and .irb_history files in Ruby?

exebook
  • 32,014
  • 33
  • 141
  • 226
wonbyte
  • 971
  • 2
  • 11
  • 23
  • 1
    What version(s) of Ruby do you have installed? Do you actually have both files present on the same machine? – Andrew Marshall Apr 16 '12 at 00:16
  • I have version 1.9.3-p125 and 1.8.7 installed. Both files exist under my home dir. I am wondering if both one is related to one version and the other the other version. – wonbyte Apr 16 '12 at 22:59

2 Answers2

1

Based on your version "#{ENV['HOME']}/.irb-history" or "#{ENV['HOME']}/.irb_history" files contain the list of all the lines that one has typed into to the irb, you can do a cat ~/.irb-history to see the contents and also irbrc.rb file will give your move details into this.

hemanth.hm
  • 4,449
  • 2
  • 22
  • 10
0

Which line editing library are you linking with Ruby?

I believe if you build ruby with GNU readline, it's using .irb-history, and if you link with libedit (if Ruby configure can't find readline), it's using .irb_history.

shigeya
  • 4,862
  • 3
  • 32
  • 33
  • I have the version OSX comes with but I also installed this version: https://gist.github.com/1688857 using cat on both files it seems one corresponds to the default OSX installation and the other is from the git version I installed. – wonbyte Apr 17 '12 at 21:55
  • Ok. You're using the falcon patch. (I guess that does not matter..) Realized that I might used the system installed ruby (I'm using OSX too) so I tried both /usr/bin/irb which linked with libedit, RVM built with GNU readline. Both writes to .irb-history, so my guess was wrong. – shigeya Apr 18 '12 at 00:45
  • I compiled my Ruby with GNU readline from Homebrew, but it still only sees `~/.irb_history`. – Franklin Yu Aug 23 '18 at 05:41
  • @FranklinYu I guess this post is two years ago, thus things might be changed. – shigeya Aug 30 '18 at 20:58