# fetch module fails - Mac OS X

**URL:** <https://forum.ansible.com/t/fetch-module-fails-mac-os-x/11600>\
**Category:** Ansible Project\
**Tags:** rhel\
**Created:** [June 4, 2012, 11:07pm UTC](https://forum.ansible.com/t/fetch-module-fails-mac-os-x/11600 "2012-06-04T23:07:03Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kumar3](https://avatars.discourse-cdn.com/v4/letter/k/ebca7d/32.png) [@Kumar3](https://forum.ansible.com/u/Kumar3)\
**Post date:** [June 4, 2012, 11:07pm UTC](https://forum.ansible.com/t/fetch-module-fails-mac-os-x/11600/1 "2012-06-04T23:07:03Z")

</div>

Hi :

&nbsp;&nbsp;Looks like the fetch module is using md5sum tool and Mac OS X the  
tool is md5.  
For Quick fix: I created a symlink for md5 as md5sum.

Kumars-MacBook-Pro:ansible kumarkandasami$ ls -l /sbin/md\*  
-r-xr-xr-x 1 root wheel 65344 Jul 11 2011 /sbin/md5  
lrwxr-xr-x 1 root wheel 9 Jun 4 14:39 /sbin/md5sum -\> /sbin/  
md5

However, the task fails that "md5 mismatch" - eventhough the checksum  
are the same on the remote and local file.

On Mac machine:  
MD5 (/tmp/xyz.tar) = 2a04e580f1bbacd3dfaf34c0bfebdc56

On Remote (Rhel) machine:  
2a04e580f1bbacd3dfaf34c0bfebdc56 xyz.tar

Obviously, the code is using the split() command that will fail on the  
Mac machine as the output format of the Mac OS X is different.

Is there a solution or workaround for this problem ?

P.S. Mac OS X = 10.7.3

Thanks,

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan](https://avatars.discourse-cdn.com/v4/letter/m/c4cdca/32.png) [@Michael\_DeHaan](https://forum.ansible.com/u/Michael_DeHaan)\
**Post date:** [June 4, 2012, 11:29pm UTC](https://forum.ansible.com/t/fetch-module-fails-mac-os-x/11600/2 "2012-06-04T23:29:08Z")

</div>

Someone would have to make the md5 parser function smart and look in two places for md5/sum, which I thought we already did. Super easy patch... How about giving it a shot?

-- Michael

---

<div class="post-metadata">

**Author:** ![John\_Kleint](https://avatars.discourse-cdn.com/v4/letter/j/df705f/32.png) [@John\_Kleint](https://forum.ansible.com/u/John_Kleint)\
**Post date:** [June 5, 2012, 3:34pm UTC](https://forum.ansible.com/t/fetch-module-fails-mac-os-x/11600/3 "2012-06-05T15:34:30Z")

</div>

How about some nice portable Python? Not sure if there’s already a module on the remote side in every case (or how you feel about python -c ;), but this actually comes out faster than md5sum on my box:

#!/usr/bin/env python

import sys  
from hashlib import md5  
from binascii import hexlify

BLOCKSIZE=64\*1024

f = open(sys.argv[1], ‘rb’)  
hash = md5()

block = f.read(BLOCKSIZE)  
while block:  
hash.update(block)  
block = f.read(BLOCKSIZE)

print hexlify(hash.digest())

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan](https://avatars.discourse-cdn.com/v4/letter/m/c4cdca/32.png) [@Michael\_DeHaan](https://forum.ansible.com/u/Michael_DeHaan)\
**Post date:** [June 5, 2012, 9:07pm UTC](https://forum.ansible.com/t/fetch-module-fails-mac-os-x/11600/4 "2012-06-05T21:07:41Z")

</div>

No.

– Michael
