Installing PHP Pear on Mac OSX 10.6 with PHP 5.3.3

Simplegeo is getting really hot these days and we have a couple of projects where we’re using it. It was Friday night and seemed like a good time to go and test some of the scripts that we had been building all week long, so I was just about to get started when I realized that Pear wasn’t installed on my Mac.

I did a quick look around and found a pretty useful link on ClickOnTyler. Though, I just got a strange error when I tried it out.

Sudhanshus-MacBook-Pro:~ sudhanshuraheja$ sudo php -q go-pear.php
PHP Deprecated: Assigning the return value of new by reference is deprecated in /Users/sudhanshuraheja/go-pear.php on line 733
Deprecated: Assigning the return value of new by reference is deprecated in /Users/sudhanshuraheja/go-pear.php on line 733
Sorry! Your PHP version is too new (5.3.3) for this go-pear.
Instead use for a more stable and current
version of go-pear, more suited to your PHP version.
Thank you for your coopertion and sorry for the inconvenience!

This is how I eventually got it to work

Sudhanshus-MacBook-Pro:~ sudhanshuraheja$ curl > go-pear.phar
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 3591k 100 3591k 0 0 20771 0 0:02:57 0:02:57 --:--:-- 22439

Sudhanshus-MacBook-Pro:~ sudhanshuraheja$ sudo php -d detect_unicode=0 go-pear.phar

Below is a suggested file layout for your new PEAR installation. To
change individual locations, type the number in front of the
directory. Type 'all' to change all of them or simply press Enter to
accept these locations.

1. Installation base ($prefix) : /Users/sudhanshuraheja/pear
2. Temporary directory for processing : /tmp/pear/install
3. Temporary directory for downloads : /tmp/pear/install
4. Binaries directory : /Users/sudhanshuraheja/pear/bin
5. PHP code directory ($php_dir) : /Users/sudhanshuraheja/pear/share/pear
6. Documentation directory : /Users/sudhanshuraheja/pear/docs
7. Data directory : /Users/sudhanshuraheja/pear/data
8. User-modifiable configuration files directory : /Users/sudhanshuraheja/pear/cfg
9. Public Web Files directory : /Users/sudhanshuraheja/pear/www
10. Tests directory : /Users/sudhanshuraheja/pear/tests
11. Name of configuration file : /Users/sudhanshuraheja/.pearrc

1-11, 'all' or Enter to continue: 1
(Use $prefix as a shortcut for '/Users/sudhanshuraheja/pear', etc.)
Installation base ($prefix) [/Users/sudhanshuraheja/pear] : /usr/local/pear

So, it basically did everything on it’s own and in the end just asked me the following, to which I said Y
Would you like to alter php.ini ? [Y/n] : Y

Finally, a little test to see if things worked
Sudhanshus-MacBook-Pro:~ sudhanshuraheja$ /usr/local/pear/bin/pear

And yes, it worked!

This entry was tagged , , , , . Bookmark the permalink.

14 Responses to Installing PHP Pear on Mac OSX 10.6 with PHP 5.3.3

  1. Thank’s!!! That works fine to me!

  2. admin says:

    That’s great Rafael! Glad to have helped.

  3. Thanks, very helpfull

  4. Giacomo says:

    Thanks a lot….. iuuuuu, it work!!

  5. admin says:


  6. split says:

    thank you for your great tutorial.
    I have a lot of problems with installing pear on my mac :(

  7. Daniel Villa says:

    For me, I had to create my file first (using touch). then change the permissions.
    chmod 0002 go-pear.phar

    This allowed me to correctly execute the command. Thanks!

  8. admin says:

    Thanks for letting me know Daniel!

  9. John says:

    Thank you so much! It actually worked!

  10. Andrew McCully says:

    Just an FYI for others, add “/usr/local/pear/bin/pear” to your .profile in your home directory to access commands just by typing ‘pear’.

    I’m sure this is obvious for some….

  11. admin says:

    Thanks for pointing it out!

  12. admin says:

    Good to hear that!

  13. ke wen says:

    I met the similar problem while work on php with smtp. 3ks for this post,I have got pear installed successful.

  14. Lee says:

    Thank youuuuuu. This made my life easier