Posted by & filed under OS X.

So, you want to run some website benchmarks from your Mac, do you? Well, good news and bad news. The good news is that your Mac already has it installed, but the bad news is that it is broken. If you’ve run the command now, you’ll probably seen the following error message:

$ ab -n 1
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd,
Licensed to The Apache Software Foundation,

Benchmarking (be patient)...apr_socket_recv: Connection reset by peer (54)

To fix this, you’ll want to run the following commands. In my example, the latest version of Apache is 2.4.3, but by the time you read this it may be a newer version, so just in case, download the latest Apache from their website.

ruby <(curl -fsSkL # install homebrew
brew install pcre # install PCRE, required by Apache
wget # download Apache
tar -xzvf httpd-2.4.3.tar.bz2 # extract Apache
cd httpd-2.4.3 # enter Apache directory
./configure && make # configure and compile Apache
sudo mv /usr/sbin/ab /usr/sbin/ab.bak # backup old ApacheBench
sudo cp support/ab /usr/sbin/ # install new ApacheBench
ab -n 1 # test new ApacheBench

There ya go! This fixes ApacheBench in OS X Lion. I’m not sure if this also affects Mountain Lion.

ApacheBench Working on OS X Lion

ApacheBench Working on OS X Lion

Thomas Hunter II

Thomas is passionate about technology and building products. A web design business created while attending college slowly evolved into a brick and mortar on Main St. of his small Midwestern hometown. His desire for fame and fortune led to the co-founding of a Y Combinator startup and a life in California.

4 Responses to “Fixing ApacheBench on OS X Lion”

  1. Barbara

    I had to symlink the compiler before configure would work:

    sudo ln -s /Applications/ /Applications/


Leave a Reply

Your email address will not be published. Required fields are marked *