# Require 'hirb' at the start of every console

**URL:** <https://www.ruby-forum.com/t/require-hirb-at-the-start-of-every-console/183536>\
**Category:** Rails\
**Created:** [February 16, 2010, 7:28am UTC](https://www.ruby-forum.com/t/require-hirb-at-the-start-of-every-console/183536 "2010-02-16T07:28:58Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Learn\_by\_D](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/e274bd/32.png) [@Learn\_by\_D](https://www.ruby-forum.com/u/Learn_by_D)\
**Post date:** [February 16, 2010, 7:28am UTC](https://www.ruby-forum.com/t/require-hirb-at-the-start-of-every-console/183536/1 "2010-02-16T07:28:58Z")

</div>

How do I make the script/console run the following commands  
automatically at the beginning whenever it starts?

ActiveRecord::Base.logger = Logger.new(STDOUT)  
require ‘hirb’  
Hirb::View.enable

I try putting these in .irbrc but it does not work.

Thanks.

---

<div class="post-metadata">

**Author:** ![Learn\_by\_D](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/e274bd/32.png) [@Learn\_by\_D](https://www.ruby-forum.com/u/Learn_by_D)\
**Post date:** [February 16, 2010, 10:01am UTC](https://www.ruby-forum.com/t/require-hirb-at-the-start-of-every-console/183536/2 "2010-02-16T10:01:07Z")

</div>

On 16 feb, 07:27, Vincent P [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> How do I make the script/console run the following commands  
> automatically at the beginning whenever it starts?
> 
> ActiveRecord::Base.logger = Logger.new(STDOUT)  
> require ‘hirb’  
> Hirb::View.enable
> 
> I try putting these in .irbrc but it does not work.
> 
> Thanks.

Did you put require ‘rubygems’ above those lines?

---

<div class="post-metadata">

**Author:** ![Learn\_by\_D](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/e274bd/32.png) [@Learn\_by\_D](https://www.ruby-forum.com/u/Learn_by_D)\
**Post date:** [February 16, 2010, 10:46am UTC](https://www.ruby-forum.com/t/require-hirb-at-the-start-of-every-console/183536/3 "2010-02-16T10:46:11Z")

</div>

Aside from require ‘rubygems’, you should also wrap that rails-  
specific setup in an ENV[‘RAILS\_ENV’].  
I explained how to do it here:

> **[Tagaholic - Hirb Tips For Rails](http://tagaholic.me/2009/09/07/hirb-tips-for-rails.html)**
>
> Hirb has been getting the attention of Rails users with Ryan Bates' screencasts. To address these newcomers I'll share some basics on setting up, customizing and configuring hirb in the con...

Gabriel
