I use macports on my macbook pro. I prefer a lot of the newer versions of the command line tools, as well as using the gnu version of some tools. As a result I like to install a number of ports with the the “+with_default_names” variant, including coreutils.
A recent run of “port upgrade outdated” caused a problem for me. It broke gettext, which caused any package to depend on gettext to break. Since coreutils depended on gettext and was first in my path, simple tools like ls, touch, mv, etc. were now broken. This in turn caused macports to break with errors like the following:
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 bit of searching brought me to this thread: http://lists.macosforge.org/pipermail/macports-users/2009-January/013330.html
It was suggested that gettext was deactivated but an attempt to activate it resulted in an error:
sudo port activate gettextPassword:
---> Activating gettext
Error: port activate failed: Image error: gettext @0.17_3 is already active.
Essentially when gettext was upgrading it failed to fully deactivate of due to a recursive dependence on itself caused by the coreutils+with_default_names.
Trying to alter PATH didn’t fix the issue either as macports has it’s own PATH. Later in the thread the solution was presented to edit the macports.conf file and set the PATH there:
1. Edit /opt/local/etc/macports/macports.conf and change this line:
#binpath /opt/local/bin:/opt/local/sbin:/bin:/sbin:/usr/bin:/usr/
sbin:/usr/X11R6/binRemove the hash at the beginning and change the order so that it reads:
binpath /bin:/sbin:/usr/bin:/usr/sbin:/opt/local/bin:/opt/local/
sbin:/usr/X11R6/bin2. Deactivate your old gettext:
sudo port deactivate gettext @0.17_3
3. Activate your new gettext:
sudo port activate gettext @0.17_4
4. Uninstall coreutils because it is not a good idea to override the
default Mac OS X file utilities:sudo port uninstall coreutils
5. Edit /opt/local/etc/macports/macporst.conf and put the binpath
line back the way it was before, including the order of the paths and
the hash at the beginning of the line.
NOTE: If the activating gettext doesn’t resolve the issue, after deactivating the old gettext, try installing it instead.
This got me back up and running again, which is good, because some of my installed ports won’t cleanly install to a fresh system (ie- proctools). It baffles me that the port maintainers allow their ports to go into the wild when they won’t even build, but that is a topic for another time.
While I didn’t bother uninstalling coreutils, as I really prefer the gnu versions to the apple provided version, at least I am now equipped to deal with these shenanigans should it happen again.

