Installing PEAR on XAMPP for Mac OS X Lion

I’m preparing to install Doctrine in order to take care of Object Relational Management within my Zend Framework projects. I use XAMPP from Apache Friends, it’s nice and simple to get up and running on pretty much every platform.

If like me you use linux quite a lot, you’ll be used to some of the commands at your disposal. OS X comes with a number of these, but it annoys me when ones I frequently use are missing. One such command is wget. Now I know we can use curl -O to the same effect, so first up I edited ~/.bash_profile and added:

alias wget='curl -O'

Now when I type wget, it will run curl, so that’s one less pain in the ass. Anyway, I’m digressing.


The next thing is, Mac comes with a php installed. if you type which php, it points to /usr/bin/php. We’re going to rename it, and soft link the xampp binary instead:

mv /usr/bin/php /usr/bin/php_orig
ln -s /Application/XAMPP/xamppfiles/bin/php /usr/bin/php

A quick

php --info

should tell you from pathnames etc that you are now running from your XAMPP binary. Now we can use that php command and say:

php -d detect_unicode=0 go-pear.phar

Last thing we do is create a soft link to your /usr/bin folder

ln -s /Applications/XAMPP/xamppfiles/bin/pear /usr/bin/pear

And thats us! we are now running the XAMPP php from the command line and pear is installed and configured ready to rock! Typing in pear should show you a bunch of options!

Tune in for more! Next Stop – Doctrine!


One thought on “Installing PEAR on XAMPP for Mac OS X Lion

  1. Jason Johnson says:

    Typo on this line: “ln -s /Application/XAMPP/xamppfiles/bin/php /usr/bin/php”
    Using this works: “ln -s /Applications/XAMPP/xamppfiles/bin/php /usr/bin/php”

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s