I have been having problem with installing gettext package from macports. When I am launching

 /opt/local/bin/port -v install apache2

it checks dependencies, and continues with gettext package installation. But the configure process freezes here:

checking for egrep... /usr/bin/grep -E

and nothing happens.. can wait hours, nothing changes.

I tried to configure, make, make install manually for that package and it went all fine. But, when same configure is launched by ports, it hangs there. Question:

1) How can that be fixed? 2) Maybe I can somehow manually tell ports, that I installed that gettext package manually already?

Sorry, if wrong "site" for this question. Felt most proper one.

sudo port -v install apache2 solved the problem :/

still unbelievable, that same operation from root user was hanging..

  • You should run as sudo /opt/local/bin/port -v install apache2 so that it runs as the correct user
    – mmmmmm
    Commented Sep 2, 2012 at 22:54
  • oh my. i was launching it from root user, entering it via sudo su
    – jancha
    Commented Sep 3, 2012 at 8:27
  • Mark, post your comment as answer - so I can mark it as resolution.
    – jancha
    Commented Sep 3, 2012 at 8:30

2 Answers 2


You need to run macport port command as root best using port as shown in all the examples in the Macports guide This is so that all the processes are set up as the correct user and the files are saved no changeable by other users.

e.g. sudo /opt/local/bin/port -v install apache2


Found this answer at http://theengguy.blogspot.com/2012/05/macports-install-gettext-hangs-on-later.html

If you are having issues with the installation of gettext and other packages hanging on macports, its most probably due to JAVA_HOME not being set. Set it and it should work:

# export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework
# /opt/local/bin/port install gettext

You probably have JAVA_HOME set in your user's environment, but not in root's. While logged in as root, I set JAVA_HOME and successfully built gettext. I've since added this to ~root/.profile so I don't have to remember it in 6 months...

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .