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 things.

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: https://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 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;

I run 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.

Recent posts View all

Web DevProductivity

Keeping on top of website updates

Learn what website updates are, what they entail, why they are important, and how we can help

Freelancing

Getting the most out of your agency

Here are some tips based on years of working with, for, and as an agency on how to get the most out of any work you do.