Search code examples
ruby-on-railsbashrails-console

.bashrc equivalent for rails console?


When I'm using the rails console I like having a clear! command along side the reload! command, so every time I launch the rails console I write

def clear!
   system('clear')
end

When I repeat behavior in my bash shell I add it to my ~/.bashrc file. Is there a similar way for me to do this for my rails console?


Solution

  • Create a file in your home directory named ~/.irbrc. Inside, define any functions or settings you want to be applied to your irb.

    Here's an example that explains what I mean.