title: org.apache.httpd: Already loaded
body: <p>I have this weird issue with apache:</p>
  
  <pre><code>$ apachectl configtest
  
  Syntax OK
  </code></pre>
  
  <p>Configs are ok, and it was actually working a minute ago, before I shut it down.</p>
  
  <pre><code>$ sudo apachectl start
  org.apache.httpd: Already loaded
  </code></pre>
  
  <p>No it's not:</p>
  
  <pre><code>$ ps ax | grep httpd
  58204 s000  R+     0:00.00 grep httpd
  </code></pre>
  
  <p>Let's try to stop it:</p>
  
  <pre><code>$ sudo apachectl stop
  </code></pre>
  
  <p>Looks like it is stopped, right? Let's try to start it again:</p>
  
  <pre><code>$ sudo apachectl start
  $ sudo apachectl start
  org.apache.httpd: Already loaded
  </code></pre>
  
  <p>So it must be running but it's not in <code>ps ax</code> and it simply doesn't work.</p>
  
  <pre><code>$ sudo apachectl stop
  $ sudo apachectl stop
  launchctl: Error unloading: org.apache.httpd
  </code></pre>
  
  <p>Tried to remove it from autostart:</p>
  
  <pre><code>$ sudo launchctl unload -w /System/Library/LaunchDaemons/org.apache.httpd.plist
  $ sudo launchctl unload -w /System/Library/LaunchDaemons/org.apache.httpd.plist
  launchctl: Error unloading: org.apache.httpd
  </code></pre>
  
  <p>But it's the same when I try to launch it, it pretends that it starts but it doesn't. Nothing in error log either. Help!</p>
  
  <p>OS X 10.8.2 Mountain Lion</p>
  
  <p><strong>Update:</strong></p>
  
  <p>After reboot:</p>
  
  <pre><code>$ sudo apachectl start
  Password:
  org.apache.httpd: Already loaded
  
  $ sudo launchctl load -w /System/Library/LaunchDaemons/org.apache.httpd.plist
  org.apache.httpd: Already loaded
  
  $ ps ax | grep httpd
  7300 s000  R+     0:00.00 grep httpd
  </code></pre>
  
  <p>So I am effectively left without a web-server now.</p>
  
  <p><strong>Solution:</strong></p>
  
  <p>After a study of <code>org.apache.httpd.plist</code> I figured out that apache is controlled by a ruby script <code>/usr/sbin/http-wrapper</code> which had some issues running because I had replaced the system ruby interpreter. This fixed it for me: </p>
  
  <pre><code>ln -s /System/Library/Frameworks/Ruby.framework/Versions/Current/usr/bin/ruby /usr/bin/ruby
  </code></pre>