Blue Screen Of Duds

Where the alter ego of codelust plays

Archive for the ‘Apple’ Category

Leopard Tip: Flushing DNS cache

leave a comment »

Instead of doing “lookupd -flushcache” you have to do “dscacheutil -flushcache”.


Written by shyam

February 1, 2008 at 12:20 pm

Posted in Apple, Leopard, OSX

Tagged with , ,

Installing Apache, PHP, MySQL, Postgresql on Mac OSX Leopard from source

with 14 comments

Update: Updated post (on December 11, 2008) here.


  1. We won’t be running any binary installations, all software will be compiled from source.
  2. The installation won’t make use of Fink or Darwinports either.
  3. These are instructions for the Intel Macs.
  4. Using this approach would mean that you will need to maintain the stack by hand.
  5. Use this information at your own risk.
  6. If you don’t want to go through all the trouble and use a binary installation, read this post.

The software stack we are going to install will be as follows:

Apache HTTP Server 2.2.6


PHP 5.2.5


MySQL 5.1.22 RC

Stock install

Postgresql 8.2.5

Stock install

We will also need to install the following software dependencies:

  1. Xcode (from the Leopard DVD or Apple Developer connection )
  2. Readline (
  3. Tidy (

This installation would not have been possible without help from the following websites:

  1. Installing Readline on OSX without using Fink or Darwinports
  2. Workaround for Tidy’s platform.h problem
  3. Installing the GD library on OSX Leopard

Now to the installation:

Install Xcode

Install MySQL

Download mysql-5.1.22-rc.tar.gz from the website
$/configure --prefix=/usr/local/mysql
$sudo make install

Update: The steps did help me in getting to install the server, but on start up it did give certain location-specific errors.

As Hill has pointed out in the comments, has not released a version of their software for Leopard, but I got 5.1.22 RC to install, run and connect from PHP without any hassles following the instructions in one of the links he had kindly posted.

Install Readline

Download the source from
There are bugs with the installation as elaborated in this link with workarounds:
$make static
$sudo make install static

Install Postgresql

Download the source from
$./configure --with-prefix=/usr/local/postgresql
$sudo make install

Install GD

Follow the instructions at

Install Tidy

Download Tidy source

This will throw up errors that can be fixed by following these instructions
$sudo make install

Install Apache

$CFLAGS="-arch i386 -isysroot /Developer/SDKs/MacOSX10.5.sdk"
$./configure \
--prefix=/usr/local/apache2 \
--enable-authn-dbm \
--enable-ssl \
--enable-dav \
--enable-info \
--enable-speling \
--disable-userdir \
--enable-rewrite \
--enable-so \

if you get an apr.h error regarding sendfile, edit the apr.h file in srclib/ext/includes and change APR_HAS_SENDFILE to ‘0’

$sudo make install

Install PHP

$./configure \
--with-apxs2=/usr/local/apache2/bin/apxs \
--prefix=/usr/local/php \
--with-pgsql=/usr/local/postgresql \
--with-mysql=/usr/local/mysql \
--with-mysqli=/usr/local/mysql/bin/mysql_config \
--with-tidy=/usr \
--with-curl=/usr/bin \
--with-curlwrappers \
--with-openssl-dir=/usr/bin \
--with-gd \
--with-jpeg-dir=/usr/local/lib \
--with-png-dir=/usr/X11R6 \
--with-zlib-dir=/usr \
--with-freetype-dir=/usr/X11R6 \
--enable-mbstring \
--with-xpm-dir=/usr/X11R6 \
--with-pdo-pgsql=/usr/local/postgresql \
--with-pdo-mysql=/usr/local/mysql \
--with-xsl=/usr/bin \
--with-ldap \
--with-xmlrpc \
--with-iconv-dir=/usr \
--with-snmp=/usr --enable-exif \
--enable-calendar \
--with-bz2=/usr \

$sudo make install

And that’s all folks!

Written by shyam

December 23, 2007 at 12:23 pm

Posted in Apache, Apple, Leopard, Mysql, OSX, PHP

Tagged with , , , , ,

Farewell ye (aka monstrosity) iTunes

leave a comment »

For all the elegance that Apple and the Mac franchise brings with it, iTunes, which is the default music player that comes with it is a serious blight on the entire set up. I’ve found it particularly infuriating since I am so used to Foobar in my previous incarnation on Windows that I can’t imagine a player that is represented by iTunes.

But, fear not. Hope is here, in fact two iterations of it.  First one is called Cog, which has the minimalistic pedigree of Foobar and is under constant development. The other one is named pretty obviously as Play. Both are fine players and I am taking my own time figuring out which one is better. Though, sadly, either player (Cog has alpha level support in the nightly builds and it is buggy for now) seems to lack CUE file support in the little that I’ve poked around with it.

On the even brighter side, I am getting spanking good sound quality from either player compared to silly iTunes. And on that very musical note iTunes gets the boot from my dock.

Written by shyam

December 15, 2007 at 7:45 pm

Posted in Apple, Leopard, Music, OSX

Running Apache 2, PHP5 (Entropy) with Postgresql on Leopard

with 4 comments

Update: New post on installing from source here.

Getting Apache 2, PHP 5, MySQL 5 and Postgresql 8 on Leopard was not as easy as it was made to look, so I am noting it down so that it could help somebody later.

This does not deal with installing PHP or Apache from source which can be a bit hairy on OSX.

This was done on OSX Leopard, I have no idea if the same will work on Tiger, Panther etc.

Follow the instructions at your own risk. It did not blow up my Macbook Pro in doing this, but I can’t guarantee you that you’ll extract the same mileage.

All binaries have been downloaded from Marc Liyanage’s website (thanks Marc!):


  1. Download the respective packages from the website
  2. Install them according the instructions
  3. Stop the httpd that is shipped with leopard (sudo /usr/sbin/apachectl stop)
  4. Backup existing PHP module: cp /usr/local/apache2/modules/ /usr/local/apache2/modules/
  5. Replace with the Entropy version: sudo cp /usr/local/php5/ /usr/local/apache2/modules/
  6. Backup existing php.ini: cp /private/etc/php.ini /private/etc/php.ini.orig
  7. Replace with the Entropy version: sudo cp /usr/local/php5/lib/php.ini /private/etc/php.ini
  8. Edit the httpd.conf in /usr/local/apache2/conf to load the PHP module
  9. Back up existing httpd.conf in /private/etc/httpd
  10. Replace it with the version in /etc/local/apache/conf
  11. Start Apache
  12. Profit?

I know it is not the best or the most proper way possible. But after many days of poking around, this was the easiest and I am not one to complain about that.

Written by shyam

December 14, 2007 at 12:47 pm

Posted in Apache, Apple, Leopard, Mysql, OSX

Leopard, Macbook Pro: First Impression From The Trenches

with 10 comments

At long last I made the switch from being a Windows user to one of those nose-in-the-air snobs who carry those beautiful laptops with leftover apple on the backside. The reasons for the switch were simple enough. I gave up my old laptop somewhere in the recent chaos and had to get a new one. Most of my options involved running Vista and it basically boiled down to the new Dell XPS M1330 and the Macbook or the Macbook Pro. While the XPS was an incredibly amazing deal at its current prices of Rs 64,000, even with the graphics card slapped on, the nagging question was that of having to run Vista.

Now, I am not a rabid anti-Windows person or a great Linux fanboy. I live by the quintessential “horses for courses” adage and have run almost everything (with the exception of the Mac, other than a stint during the journalism school days), including variants of Windows from the 3.x days, DOS, Netware, Linux, BSD, AIX etc, during my time. In my daily dalliance with computers over the past four years, Windows XP has dominated every part of it (other than the servers) and I have a pretty intimate knowledge of Windows XP by now. That said, keep XP clean of attacks, viruses and various infections is a dark art and a game of cat and mouse that never ends.

The question thus (with a Rs 30,000 mark up on it) was if I wanted to spend my time on yet another learning curve wrangling Vista to behave to my liking. From what I have seen of VIsta, it is a major upgrade that will require me to relearn jumping through the myriad hoops involved in learning any Microsoft OS. On the other hand, I am very comfortable with the command line, though for using a desktop it is not my ideal choice on any given day. Thank you, but I shall keep my point-and-click sensibilities with me any day. And as you know by now, the lure of the shiny Apple won.

In terms of a regular desktop experience, Apple and OSX has been a delight. I will not reiterate what’s been said so many times before: that things just work on the damn thing. A network printer that normally takes me about 15 clicks to add on XP took just three clicks on OSX. It looks and behaves like one of those stunning supermodels – what you get to see is more or as equally tantalizing as what is being very thinly hidden from your eyes. On the other hand, most of the trouble I’ve had are with my development platform. More on that later.

My current desktop stack includes Adium (instant messaging), Firefox (, not the 3.x beta), Freemind (mindmapping), Fugu (SFTP), SVNX (Subversion client), VMWare Fusion (for Microsoft Office and Outlook, I know, sigh) Ecto (blogging, oh yes!) and JellyfiSSH (SSH client front end). In terms of performance Adium is lovely, Firefox is pretty similar to how it behaves in Windows, Freemind has been spotty (Leopard Java issues, I presume), VMWare Fusion is absolutely awesome, though Outlook is patchy. In short, it has been pretty nice to me till date.

Incidentally, I run only Microsoft Office under VMWare Fusion. Initially, I had dedicated a whole 700 MB of RAM to the VM, then chopped it to 512 MB and now it is running at a healthy 256 MB. In the long run, I do intend to see how Office for Mac 2008 holds up and move to it. Irrespective of whatever RAM I end up giving to Fusion, when it does run, I get less than 200 MB of RAM to spare. I do not know if it is any better if you run it as a real VM than a Bootcamp version, but this is only a stopgap arrangement.

Things have been different though on the developer side. I am one of those people who love to compile my development stack from source and YUM on Centos has throughly spoiled me on that count. The shortest compile instructions that I’ve seen for any OSX software runs into several screenfuls and there seems to be no sane way to get the dependency libraries in place (nobody has a straight answer whether FInk or Macports is the better option).

OSX Leopard itself runs with Apache 2.2.x and PHP 5, but it does not have the Postgresql module complied in and I have not been able to get the Entropy distribution to start up with PHP enabled for some bizarre reason that I’ve not had the time to figure out yet. I grabbed the Postgresql binary from Entropy and MYSQL server from, well, My other dependency, on Eclipse PDT, has currently hit a wall with the PHP situation and I have not taken a look yet at what major hara-kiri it would take for me to get it running with Xdebug on OSX. So the jury is still out on that one.

In conclusion I am happy that I made the switch. In terms of both hardware and software Apple and OSX is an elegant combination. I have no idea how much pain the development set up would give me, but even in the worst case scenario I could run a server install in a VMware Fusion session and forget all about it. But the most important point is that the Mac has allowed me to take my time off from maintaining my desktop environment and till OSX worms and viruses are a commonplace occurrence I think that should hold. As far as Vista goes, I’ve helped a couple of my lads in my team with it and I want to stay as far away from it as possible.

Written by shyam

December 10, 2007 at 4:39 pm

Posted in Apple, Leopard, OSX