1

I'm setting up a dev environment on a mac OS-X (10.8.3).

My apachectl seems to be referencing /opt/usr/sbin/apachectl:

$ sudo apachectl start
$ ps aux | grep httpd | grep -v grep
_www             898   0.0  0.0  2436168    704   ??  S    11:46AM   0:00.00 /usr/sbin/httpd -D FOREGROUND
root             897   0.0  0.1  2436168   4308   ??  Ss   11:46AM   0:00.18 /usr/sbin/httpd -D FOREGROUND

However, apachectl in /opt/local/apache2/bin/apachectl seems to be driving the (correctly configured) webserver for my local machine.

$ sudo /opt/local/apache2/bin/apachectl start
$ ps aux | grep httpd | grep -v grep
_www             916   0.0  0.0  2455992    688   ??  S    11:47AM   0:00.00 /opt/local/apache2/bin/httpd -k start
_www             915   0.0  0.0  2455992    688   ??  S    11:47AM   0:00.00 /opt/local/apache2/bin/httpd -k start

I installed MAMP, before realizing I didn't want it and removing it. As far as I can tell apachectl is not aliased:

$ alias
alias ll='ls -la'
$

So I'm not sure, apart from deleting apachectl in /usr/sbin/, how to correct this - and that only with a new alias. That seems like a very unclean solution. Can anyone provide pointers on how to rewire my mac to no longer have this problem? Or even verify what apachectl is pointed to (or how to change that)? Thanks!

2 Answers 2

5

Does whereis apachectl give any output? That'll tell you where it's being pointed. If you have it in two locations most likely one of them is a symlink to the other. You can verify this with ls -l and it'll point out a symlink if there is one.

2
  • Ah! whereis was exactly what I needed to show where apachectl is. Thanks! It is definitely pointed to /usr/sbin... but what is doing that? It's not alias. Neither apachectl is a symlink. May 14, 2013 at 19:17
  • Two separate apache installs maybe? Sometimes certain packages will install it as well.
    – Nathan C
    May 14, 2013 at 20:17
1

The /usr/sbin/apachectl is installed by default in OSX; and, probably not a good idea to delete it. Instead, you could modify your $PATH environment variable so that /opt/local/bin takes precedence over /usr/sbin. Beware that this can have unintended consequences if you have very many packages installed in /opt/, as some program versions might suddenly be different than what they were before.

You must log in to answer this question.

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