Categories
programming server admin

How to install PEAR on OS X 10.5

The simple guide I found here doesn’t actually work, although it “mostly” works. Several bits are out of date. Even then it only *partly* works, because it leaves all PEAR commands as requiring root to run. That may be what you want, but I doubt it. Not what I wanted.

Correct way would be:

  1. From a newly-opened Terminal, type: curl http://pear.php.net/go-pear | sudo php
  2. When it’s finished downloading, enter your login password (the prompt sometimes is hard to see)
  3. Change the “1. Installation prefix ($prefix) :” to be “/usr/local”
  4. Change the “2. Temporary files directory :” to be “/tmp” (on OS X this is currently symlinked to the correct OS X equivalent, which is /private/tmp)
  5. From Terminal, type: sudo chmod a+w /usr/local/PEAR
  6. From Terminal, type: sudo chmod a+w /usr/local/PEAR/docs/
  7. From Terminal, type: sudo chmod a+w /usr/local/PEAR/tests/
  8. Restart Apache2. If you’ve enabled OS X’s built-in copy of Apache2, then just go to System Preferenes, select “Sharing”, UNcheck the “web sharing”, wait until the green light beside “Web Sharing” goes grey (instead of yellow), and finally CHECK the “Web Sharing” box again.

…there are probably some other things you need to chmod as a+w in the PEAR directory – if you want a hassle-free life, you could just do this instead:

From Terminal, type: sudo chmod -R a+w /usr/local/PEAR

…which will do ALL files and ALL sub-directories of PEAR.

Last thing (that I’m not sure how to deal with) is that I’m not 100% sure the files should be owned by “root:wheel”, but I don’t yet know enough about OS X to know what the correct ownership of those files is. Everything else (*everything*) in my /usr/local is owned by “root:wheel”, so maybe that is correct?

PS: IMHO any developer who creates a custom packaging system that is INDEPENDENT-OF and INTERFERES-WITH the native OS should be shot. This is a peculiar mental disease that infects Perl (and, it seems by extension, PHP) developers. They should have a look at Java and take note (Sun got it right for once) – you have a simple choice, with two options.

Option 1: let the OS handle everything
Option 2: handle everything yourself, by making a unique binary install for EVERY different OS.

There is no Option 3. The world of PHP programming would be a better, simpler place if more people had understood this :).

PPS: a developer who then further takes the step of *not supporting* people who don’t use their proprietary, OS-interfering, packaging system (PEAR, I’m looking at you – where’s the explicit dependency list for each package? Nowhere easy to find) should be revived … and then shot again.

PPPS: …even though I’d almost certainly do the same if I were them. It’s too much hassle to support people who don’t use your standard installer, even if said installer does suck donkey.