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:

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;

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


How to ignore Bullet in RSpec tests

Using Bullet during a test can pick up mistakes but also has false negatives; here is an easy way to ignore them


How we used Nokogiri to fix a sizing issue in YouTube's oEmbed

At some point, one of our calls to YouTube's oEmbed endpoint was returning videos way too small; we fixed in in our Rails application by using Nokogiri