ERROR: Error installing rmagick:

when I tried to install rmagick,

gem install rmagick

error occured

Building native extensions.  This could take a while...
ERROR:  Error installing rmagick:
	ERROR: Failed to build gem native extension.

/opt/ruby-enterprise-1.8.7-2010.02/bin/ruby extconf.rb
checking for Ruby version >= 1.8.5... yes
checking for gcc... yes
checking for Magick-config... yes
checking for ImageMagick version >= 6.4.9... no
Can't install RMagick 2.13.1. You must have ImageMagick 6.4.9 or later.

*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.  Check the mkmf.log file for more
details.  You may need configuration options.

Provided configuration options:
	--with-opt-dir
	--without-opt-dir
	--with-opt-include
	--without-opt-include=${opt-dir}/include
	--with-opt-lib
	--without-opt-lib=${opt-dir}/lib
	--with-make-prog
	--without-make-prog
	--srcdir=.
	--curdir
	--ruby=/opt/ruby-enterprise-1.8.7-2010.02/bin/ruby


Gem files will remain installed in /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/rmagick-2.13.1 for inspection.
Results logged to /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/rmagick-2.13.1/ext/RMagick/gem_make.out

I already have installed ImageMagick-6.7.4-4.
PATH for ImageMagick-6.7.4-4 and try installing rmagick gem again.

PATH=$PATH:/usr/local/ImageMagick-6.7.4-4/bin gem install rmagick

error occured.

Building native extensions.  This could take a while...
ERROR:  Error installing rmagick:
	ERROR: Failed to build gem native extension.

/opt/ruby-enterprise-1.8.7-2010.02/bin/ruby extconf.rb
checking for Ruby version >= 1.8.5... yes
checking for gcc... yes
checking for Magick-config... yes

Warning: Found more than one ImageMagick installation. This could cause problems at runtime.
         /usr/local/ImageMagick-6.7.4-4/bin/Magick-config reports version 6.7.4 Q16 is installed in /usr/local/ImageMagick-6.7.4-4
         /usr/bin/Magick-config reports version 6.2.8 is installed in /usr
Using 6.7.4 Q16 from /usr/local/ImageMagick-6.7.4-4.

checking for ImageMagick version >= 6.4.9... yes
checking for HDRI disabled version of ImageMagick... yes
Package MagickCore was not found in the pkg-config search path.
Perhaps you should add the directory containing `MagickCore.pc'
to the PKG_CONFIG_PATH environment variable
No package 'MagickCore' found
Package MagickCore was not found in the pkg-config search path.
Perhaps you should add the directory containing `MagickCore.pc'
to the PKG_CONFIG_PATH environment variable
No package 'MagickCore' found
Package MagickCore was not found in the pkg-config search path.
Perhaps you should add the directory containing `MagickCore.pc'
to the PKG_CONFIG_PATH environment variable
No package 'MagickCore' found
Package MagickCore was not found in the pkg-config search path.
Perhaps you should add the directory containing `MagickCore.pc'
to the PKG_CONFIG_PATH environment variable
No package 'MagickCore' found
checking for stdint.h... yes
checking for sys/types.h... yes
checking for wand/MagickWand.h... yes
checking for InitializeMagick() in -lMagickCore... no
checking for InitializeMagick() in -lMagick... ye
....

PATH for 'MagickCore' also needed.

find /usr/local -name MagickCore.pc
/usr/local/ImageMagick-6.7.4-4/lib/pkgconfig/MagickCore.pc

then

PKG_CONFIG_PATH=/usr/local/ImageMagick-6.7.4-4/lib/pkgconfig PATH=$PATH:/usr/local/ImageMagick-6.7.4-4/bin gem install rmagick

Success!