Friday, January 18, 2013

Fixing 10.8.x ldapdl error messages

If you have a lot of entry in your OSX 10.8+ logs like this
Error loading /System/Library/Security/ldapdl.bundle/Contents/MacOS/ldapdl: dlopen(/System/Library/Security/ldapdl.bundle/Contents/MacOS/ldapdl, 262): no suitable image found. Did find:
/System/Library/Security/ldapdl.bundle/Contents/MacOS/ldapdl: mach-o, but wrong architecture

that means the programs make those log enties are trying to load the ldapdl binary from a 32 bit application and unfortunately the ldapdl version came with 10.8 is a 64 bit only binary. As a temporary solution (till those programs not updated to theirs 64 bitcounter part) you can make an unibin version from an earlier 32 and the current 64 bit version.

1. copy the 10.7.x version of the binary to a temp place, I've used my desktop

2. extract the 32 bit binary from a 10.7.x version to a temp place, that was may desktop too
lipo -extract i386 -output ~/Desktop/ldapdl ~/Desktop/ldapdl.bundle/Contents/MacOS/ldapdl

3. extract the 64 bit binary from the 10.8.x version to a temp place, that was may /var/tmp
lipo -extract x86_64 -output /var/tmp/ldapdl /System/Library/Security/ldapdl.bundle/Contents/MacOS/ldapdl

4. Backup your old 10.8.x binary
sudo mv /System/Library/Security/ldapdl.bundle/Contents/MacOS/ldapdl your_backup_place

5. Put the i386 and x86_64 versions together to the official place
sudo ~/Desktop/ldapdl /var/tmp/ldapdl -create -output /System/Library/Security/ldapdl.bundle/Contents/MacOS/ldapdl

6. Correct the owner of the produced file
sudo chown root:wheel /System/Library/Security/ldapdl.bundle/Contents/MacOS/ldapdl

7. Check if everything was fine.
ls /System/Library/Security/ldapdl.bundle/Contents/MacOS/ldapdl
-rwxr-xr-x 1 root wheel 219968 Jan 18 13:12 /System/Library/Security/ldapdl.bundle/Contents/MacOS/ldapdl*

lipo -info /System/Library/Security/ldapdl.bundle/Contents/MacOS/ldapdl
Architectures in the fat file: /System/Library/Security/ldapdl.bundle/Contents/MacOS/ldapdl are: i386 x86_64

Original tip can be found here, thanks!