Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

How can I recover the apachectl on my OSX?

I deleted it, somehow, and now the command apachectl doesn't exist anymore.

share|improve this question
3  
Do you... have any backups? use Time Machine? have the 10.8 install media? –  jscott Jan 31 '13 at 1:50
2  
/usr/sbin isn't in your PATH usually. What does ls -l /usr/sbin/apachectl return? –  patrix Jan 31 '13 at 6:44
    
@jscott I have a Macbook Pro, there is no install media, and no, I don't use Time Machine, at least until it happened. –  Daniel Ribeiro Jan 31 '13 at 10:31
    
@patrix returns ls: /usr/sbin/apachectl: No such file or directory –  Daniel Ribeiro Jan 31 '13 at 10:32
1  
@patrix In lieu of building apache from Apple's source, it may be quicker to find another 10.8 user and get a copy from them. –  jscott Jan 31 '13 at 12:01
show 1 more comment

migrated from serverfault.com Jan 31 '13 at 3:09

This question came from our site for professional system and network administrators.

2 Answers

up vote 2 down vote accepted

On 10.8 apachectl is a ~50 SLOC shell script. I uploaded the one from my installation here. For example apachectl start just runs (sudo) launchctl load -w /System/Library/LaunchDaemons/org.apache.httpd.plist, so you don't necessarily even need apachectl.

share|improve this answer
add comment

If you build Apache httpd from the source code, you can get the apachectl binary from <apache_src_dir>/support/apachectl.

share|improve this answer
1  
Welcome to Ask Different! Can you please elaborate the answer to explain how one can rebuild apache from source? –  patrix Feb 25 '13 at 7:48
add comment

We're looking for long answers that provide some explanation and context. Don't just give a one-line answer; explain why your answer is right, ideally with citations. Answers that don't include explanations may be removed.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.