RHEL6 and CentOS 6: missing libmcrypt and libmhash in default repository

Mattias Geniar, Thursday, November 24, 2011 - last modified: Wednesday, October 23, 2013

For God-knows-what reason, the libmcrypt and libmhash aren't included in the default repository for CentOS 6 or Red Hat Enterprise Linux 6. So you'll run into the following when trying to compile PHP.

configure: error: mcrypt.h not found. Please reinstall libmcrypt.

And you can't install it.

# yum install libmcrypt-devel
No package libmcrypt-devel available.
Error: Nothing to do

The (only) solution so far: grab the packages from the EPEL repository. Download the RPM (it's same RPM for i386, i686 and x86_64) and install it.

# rpm -ivh “http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm”

And you can install it as "yum install libmcrypt-devel" again. Or libmhash, just the same.

Hi! My name is Mattias Geniar. I'm a Support Manager at Nucleus Hosting in Belgium, a general web geek, public speaker and podcaster. Currently working on DNS Spy. Follow me on Twitter as @mattiasgeniar.

I respect your privacy and you won't get spam. Ever.
Just a weekly newsletter about Linux and open source.

SysCast podcast

In the SysCast podcast I talk about Linux & open source projects, interview sysadmins or developers and discuss web-related technologies. A show by and for geeks!

cron.weekly newsletter

A weekly newsletter - delivered every Sunday - for Linux sysadmins and open source users. It helps keeps you informed about open source projects, Linux guides & tutorials and the latest news.

Share this post

Did you like this post? Will you help me share it on social media? Thanks!


Levent Pinar Friday, March 23, 2012 at 00:53

Thanks, worked as described


Bryon Monday, March 26, 2012 at 07:08

A+++ thanks, 10/10


Liza Velazquez Friday, August 31, 2012 at 00:29

Save my life. Thanks


indra Saturday, September 1, 2012 at 08:00

thanks Mattias, you saved my day


Yatin Thursday, April 18, 2013 at 19:31

Updated URL … rpm -ivh “http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm”


Ashwani Monday, August 12, 2013 at 03:31

Thanks Mattias


Sharl Monday, July 28, 2014 at 07:48

thx for sharing this point.


bibi Friday, July 21, 2017 at 17:52

Thank you so much


makemelike Thursday, August 31, 2017 at 10:13

Will work , also:

yum –enablerepo=extras install epel-release
yum install libmcrypt-devel

[According official documents , first command is for enable EPEL Repositories].


Leave a Reply

Your email address will not be published. Required fields are marked *