problem in installlation of ferret search plugin in rails application

When i went to installation ferret in my rails application then i have
faced a problem that is look like this
ERROR: While executing gem ... (Gem::FilePermissionError)
    You don't have write permissions into the /var/lib/gems/1.8
directory.
i used this command for ferret install
sudo gem install ferret

If you have any preference in using a search engine for your site, I
would recommend ultrasphinx, much more stable than ferret.

http://blog.evanweaver.com/files/doc/fauna/ultrasphinx/files/README.html

You don't have enough info here to really help you. what platform,
etc... Check to see who the dir belongs to 'ls -l'

Can you install any other gems?

Serge