Search code examples
phpmacospear

sudo: pear: command not found


I have snow leopard which apparently has php with pear pre-installed. I enabled php but could not find any signs of PEAR. So I have installed it and now phpinfo() shows its installation

include_path .:/usr/lib/php/share/pear

Still when I type in any pear command

$ sudo pear

I get an error: sudo: pear: command not found

What am I missing?


Solution

  • Many ways to skin this cat, but I would type this if you have locate installed (which you probably do):

    $ locate bin/pear
    

    That should list one or more things, one of which will look like the path to pear. Let's say it says something like /usr/local/bin/pear. Then your next command is:

    $ sudo /usr/local/bin/pear
    

    Two caveats come to mind:

    1. It's possible that locate will list multiple executable pear files. If that's the case, it may be important to pick the right one based on which PHP you're using.
    2. You may want to add the directory where pear is located to your PATH environment variable.