Monday, January 17, 2011

Compiling Squid on OSX

In a burst of enthusiasm I decided to try to build and compile Squid on OSX.

First you need XCode and developer tools from either your DVD or the Apple web site.

Then download the source code from squid-cache.org. Current version is 3.1.10 released 22 Dec 2010. Current version are here. I downloaded the bz2, any will work. I moved it to the XCode folder on my hard disk, in the path

/XCode/squid

The run these commands:


tar xjf squid-3.1.10.tar.bz2
cd squid-3.1.10
./configure --enable-ssl
make
sudo make install

Some notes:

  • Don't have any spaces in the path to the source code else the build WILL fail!
  • The only build option I used is to enable SSL so I can proxy https. For a full list of whats available you can do
    ./configure --help
    for ease of use you can pipe this to a text file for reading:
    ./configure --help >build_options.txt
  • It can take some time, do not worry
  • You will get some errors, do not worry, as long as there is no space in the path!
  • If you do get errors, likely XCode needs re-installing
This builds squid and put in in the default location which is

/usr/local/squid

It also has the default modules, so you can play.

Next, chown the Squid's directory so it has write access to its logs and caches:

sudo chown -R nobody:wheel /usr/local/squid


Then you need to create the cache directories:

sudo /usr/local/squid/sbin/squid -z

The default config file works OK! The only out of the box change I would make is to remove the image from the error file. In the file

/usr/local/squid/etc/errorpage.css

find the line

"background: url('http://www.squid-cache.org/Artwork/SN.png') no-repeat left;"

and delete it. Save the file.

Now, start Squid:

sudo /usr/local/squid/sbin/squid

You can point you local machine to 127.0.0.1:3128 and show its working.

if you decide to enable the cache, and then do

sudo /usr/local/squid/sbin/squid -k reconfigure

you might get

"2011/01/15 14:44:08| WARNING cache_mem is larger than total disk cache space!"

do not worry, its a spurious error. Things will still work OK.

See some other postings on
Squid and OSX.

2 comments:

Anonymous said...

Hi I got this error at the end of the make command. I tried make install to see if it would work but I got the same error. I have compiled this before succesfully without the ssl option. Need help. Thanks

make[3]: *** [AsyncCall.lo] Error 1
make[2]: *** [all-recursive] Error 1
make[1]: *** [all] Error 2
make: *** [all-recursive] Error 1

Anonymous said...

Hi I got this error at the end of the make command. I tried make install to see if it would work but I got the same error. I have compiled this before succesfully without the ssl option. Need help. Thanks

make[3]: *** [AsyncCall.lo] Error 1
make[2]: *** [all-recursive] Error 1
make[1]: *** [all] Error 2
make: *** [all-recursive] Error 1