Installing PEAR for PHP on OSx
A guide on how you can go about installing PEAR for PHP on OSx
Along your PHP travels you will hear noises relating to installing something from PEAR to help you with some PHP snizz.
PEAR is simply a code repository, in fact PEAR stands for PHP Extension and Application Repository.
Installing it is a breeze assuming you already have php installed (you can verify this by typing
php -v into your command line).
The first thing to check is that it isn't already installed — a quick command will verify;
pear version. If this brings back version information then you are good to go, if it reports
Command not found then follow these simple steps.
Download the phar file at this location: http://pear.php.net/go-pear.phar
Run PHP on the file, so if you downloaded it to your Downloads folder then run
sudo php go-pear.phar.
You will be asked some installation questions, I quite like the defaults but feel free to change whatever you want.
Next if you have accepted the defaults you will probably want to add PEAR to your path so that you can call it easily from the command line. I like to do this in vi but there are several ways to achieve it;
sudo vi ~/.profile and add in my PATH to the bottom of the document;
export PATH=/Users/YOUR_USER_NAME/pear/bin:$PATH, I then reload my profile with
. ~/.profile and that is me, now if I run
pear version I get version information.