Saturday, April 18, 2009

MacPorts failing to upgrade gettext with +with_default_names

MacPort 1.7.1 breaks itself when trying to upgrade from gettext 0.17_3 to 0.17_4 when coreutils are installed with +with_default_names, here's how to fix it.

First off, the symptom will be:
--->  Deactivating gettext @0.17_3
dyld: Library not loaded: /opt/local/lib/libintl.8.dylib
Referenced from: /opt/local/bin/rm
Reason: image not found
Error: Deactivating gettext 0.17_3 failed: 0
Error: Unable to upgrade port: dyld: Library not loaded: /opt/local/lib/libintl.8.dylib
Referenced from: /opt/local/bin/ln
Reason: image not found
Error: Unable to upgrade port: dyld: Library not loaded: /opt/local/lib/libintl.8.dylib
Referenced from: /opt/local/bin/ln
Reason: image not found
Error: Unable to upgrade port: dyld: Library not loaded: /opt/local/lib/libintl.8.dylib
Referenced from: /opt/local/bin/ln
Reason: image not found
A thread on macports-users explains how to fix this:
  1. Edit /opt/local/etc/macports/macports.conf and add this line at the end of the file:
    binpath /bin:/sbin:/usr/bin:/usr/sbin:/opt/local/bin:/opt/local/sbin:/usr/X11R6/bin

  2. port deactivate gettext

  3. port install gettext

  4. Remove the line you added in step 1.

  5. Re-run the initial command you were running to resume the upgrade of whatever you were upgrading.
Ryan Schmidt said that he was considering to remove +with_default_names but I disagree with his statement that "it's probably not good to override those default Mac OS X utilities". The GNU coreutils are vastly superior to the BSD ones and what's the point of installing them without +with_default_names? Having to prefix almost every single command with `g' is a waste of time.