Click to search Andy Jarrett.co.uk RSS feed

Loading Twitter

Building and installing Apache 2 on a Mac

Ok Below is a rough guide to get anyone up and going when it comes to building and installing Apache 2 from source. We're gonna do this all from the Terminal found in /Applications/Utilities/Termain.app.

Please note that '$' means new line, don't type this character If you want to know about any of the commands we make from the terminal you can always type "man + command" e.g.

view plain print about
1$ man curl
If you run the above code it should tell you that
curl is a tool to transfer data from or to a server, using one of the supported protocols (HTTP, HTTPS, FTP, FTPS, GOPHER, DICT, TELNET, LDAP or FILE). The command is designed to work without user interaction.

This will also detail the options I use.

1: Download Apache 2 from source. Now you can do this from the browser by simply going to http://httpd.apache.org/ but where is the fun in that :o) From the Termainal type:

view plain print about
1$ curl -O http://www.eu.apache.org/dist/httpd-2.2.0.59.tar.gz
2$ gnutar -xzf httpd-2.0.59.tar.gz

2: Building
Our installation of Apache2 is going to be stored on the root i.e. /apache2

view plain print about
1$ cd httpd-2.2.2
2$ sudo ./configure --prefix=/apache2

3: Installing

view plain print about
1$ sudo make
2$ sudo make install

4: Starting and Stopping Apache 2 Apache 2 should now be installed.

To start Apache 2:

view plain print about
1$ sudo /apache2/bin/apachectl start

To restart Apache 2:

view plain print about
1$ sudo /apache2/bin/apachectl restart

To stop Apache 2:

view plain print about
1$ sudo /apache2/bin/apachectl stop

That's all you need to get it installed. Once you are at this point the next move is to edit the httpd.conf file, which you can find at /apache2/conf/httpd.conf

Comments Comments (7) | Print Print | Send Send | 4841 Views

If you like what you see on the website and/or this post has helped you out in some way please consider donating to help keep me in beer vodka. The donations are made through Paypal, which accepts almost any credit card or eCheck.

(Comment Moderation is enabled. Your comment will not appear until approved.)
I found the following very helpful when I was building Apache from source on the Mac.

http://www.devshed.com/c/a/Apache/Building-Apache-...
Ulf's Gravatar Posted By Ulf @ 6/12/07 11:36 PM
Hi Andy,

how did you connect Coldfusion MX 7.02 to your new Apache 2.2 - that failed for me so I switched back to included Apache 1.3...

If you get it to work, maybe you post a step by step tutorial, that would be great.

Thanks.

Ulf
Hey Andy,
I am running into a roadblock:
configure: error: no acceptable C compiler found in $PATH
following step 2 after configure
I have been trying to find a gcc but all I cant find a binary (don't have a compiler (-:).
Any thoughts??
D.
@doug silly question, you on a mac? if so which version? You might want to try the following command in the Terminal: "echo $PATH" (without the quotes)

if so what does that return?
Andy, not silly at all -- I am on a mac, converted one week ago (not completely weaned off of my Win box yet). I have a 13" MacBook running 10.4.10. Trying to install Apache from source.

Here is the return from echo $PATH:
/usr/local/bin:/bin:/sbin:/usr/bin:/usr/sbin

Here is the entire transcript from Terminal:

Dougrs-Computer:~ dougr$ curl -O http://apache.mirrors.tds.net/httpd/httpd-2.2.4.ta...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 6216k 100 6216k 0 0 654k 0 0:00:09 0:00:09 --:--:-- 641k
Dougrs-Computer:~ dougr$ gnutar -xzfhttpd-2.2.4.tar.gz
Dougrs-Computer:~ dougr$ cd httpd-2.2.4
Dougrs-Computer:~/httpd-2.2.4 dougr$ sudo ./configure --prefix=/apache2
Password:
checking for chosen layout... Apache
checking for working mkdir -p... yes
checking build system type... i386-apple-darwin8.10.1
checking host system type... i386-apple-darwin8.10.1
checking target system type... i386-apple-darwin8.10.1

Configuring Apache Portable Runtime library ...

checking for APR... reconfig
configuring package in srclib/apr now
checking build system type... i386-apple-darwin8.10.1
checking host system type... i386-apple-darwin8.10.1
checking target system type... i386-apple-darwin8.10.1
Configuring APR library
Platform: i386-apple-darwin8.10.1
checking for working mkdir -p... yes
APR Version: 1.2.8
checking for chosen layout... apr
checking for gcc... no
checking for cc... no
checking for cc... no
checking for cl... no
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details.
configure failed for srclib/apr
Dougrs-Computer:~/httpd-2.2.4 dougr$ echo $PATH
/usr/local/bin:/bin:/sbin:/usr/bin:/usr/sbin
Dougrs-Computer:~/httpd-2.2.4 dougr$

Pretty much crying for a compiler eh?
D.
Looks like this is related to my not having everything installed that I need from my install disc. I received this machine from work and found out this morning that the developer tools from the install disk had not been installed. This machine actually was the owners who was running Win from bootcamp and never used the Mac side at all. Anyway, I will look into that today- I bet that will solve the issue because GCC is part of the install.
D.
Hey Andy-That was it!
Thanks,
dougrdotnet
BlogCFC by Raymond Camden + Twitter @AndyJ + ColdFusion jobs + Contact Me + Snippets/Downloads + RSS .