Coolest Guides on the Planet

coolest guides on the planet

Coolest Guides On The Planet

  • Home
  • macOS
  • WebDev
  • All Posts
  • Contact

Installing PEAR on OSX 10.11 El Capitan

March 7, 2016 28 Comments

PEAR is a popular PHP package manager, it doesn’t come by default on OSX, here is a tutorial how to install PEAR on OSX 10.11 El Capitan and earlier versions of OSX including Yosemite and Mavericks.

These commands need to be entered via the command line so crank open your Terminal application.

First up

Move into your home directory

cd

Check if you have it

pear version

If not, get it

curl -O  http://pear.php.net/go-pear.phar

Install Pear

php -d detect_unicode=0 go-pear.phar

The installation will suggest the file locations for you and these will be based on your home directory (older versions of pear installed these in a system wide location of /usr/local) – but if its just you using this then the defaults are fine – just click enter.

pear-osx-installation

Add PEAR to your PATH

Next up is to add pear to your shell path, you can add this in your .bash_profile which is an invisible file in your home directory

cd 
nano .bash_profile

Add to your PATH variable:

/Users/USERNAME/pear/bin

So the PATH variable line will look something like this, each path is separated by a colon and finished with the variable $PATH, in the example below the pear path is the 2nd one

export PATH="/usr/local/mysql/bin:/Users/USERNAME/pear/share/pear/:$PATH"

Refresh the profile

source .bash_profile

Verify

pear version

Output should be

PEAR Version: 1.10.1
PHP Version: 5.5.5
Zend Engine Version: 2.5.0
Running on: Darwin 192-168-1-9.tpgi.com.au 15.3.0 Darwin Kernel Version 15.3.0: Thu Dec 10 18:40:58 PST 2015; root:xnu-3248.30.4~1/RELEASE_X86_64 x86_6
That’s PEAR installed and ready. NOw you need to add the Pear path to your PHP install.

 

Add PEAR to your PHP

As well as adding pear to your shell path you also have to add the pear location to your PHP installation so you can run the PEAR binaries, which is done via your php.ini file.

If your OSX install has not been customised it will be in /etc and maybe named php.ini.default which you will need to duplicate and just name php.ini – if your PHP is somewhere else find it by adding in on the command line…

php --ini

In this example I have a different PHP path

Configuration File (php.ini) Path: /usr/local/php5/lib
Loaded Configuration File: /usr/local/php5/lib/php.ini

Anyway when you get it, open it and under ‘Paths and Directories’ add into the php.ini file…

include_path = ".:/Users/YOURUSERNAME/pear/share/pear/"

Now you can work with your PEAR packages, below are some basic commands…

To list your PEAR packages

pear list

Output should be similar to:

Installed packages, channel pear.php.net:
=========================================
Package          Version State
Archive_Tar      1.4.0   stable
Console_Getopt   1.4.1   stable
PEAR             1.10.1  stable
Structures_Graph 1.1.1   stable
XML_Util         1.3.0   stable

To install a PEAR package, for example PHP_codesniffer, run

pear install PHP_codesniffer

To upgrade PEAR

pear upgrade pear

To upgrade PEAR packages either name the package name after the command or to upgrade all just run

pear upgrade

To remove a PEAR package

pear uninstall PHP_CodeSniffer

Cats: macOS, WebRoot

Tags

3gs 10.6 apache backup baseband boot clean urls cpanel css curl custom database drupal el capitan git Google image instadmg ios iphone jailbreak keys lion mac macos mojave macos sierra menu mysql OSX panda php phpmyadmin private public redirect redsn0w remote rsa SEO shell ssh terminal unstoppables upgrade urls

Donate a Beer to the Coolest Guides

Get Beaver Builder Now!

Discuss

3gs 10.6 apache backup baseband boot clean urls cpanel css curl custom database drupal el capitan git Google image instadmg ios iphone jailbreak keys lion mac macos mojave macos sierra menu mysql OSX panda php phpmyadmin private public redirect redsn0w remote rsa SEO shell ssh terminal unstoppables upgrade urls
Get DesktopServer

Lynda

Lynda.com Online Training Videos

TreeHouse

smlinks

Learn WordPress
osx-modify-shell-path

How to Add to the Shell Path in macOS Big Sur and Catalina using Terminal

October 19, 2019

virtual-hosts osx 10.10 yosemite

Set up Virtual Hosts on macOS Catalina 10.15 in Apache

October 19, 2019

Installing Homebrew on macOS Catalina 10.15, Package Manager for Linux Apps

October 18, 2019

Where is the bash shell in macos Catalina?

October 12, 2019

Refine your search

  • All
  • Modules
  • Themes
  • Documentation
  • Forums & Issues
  • Groups

RSS ars technica

  • Google hits back after Apple exec says AI is hurting search
  • Apple: “Hundreds of millions to billions” lost without App Store commissions
  • Matter update may finally take the tedium out of setting up your smart home
  • Cue: Apple will add AI search in mobile Safari, challenging Google
  • Apps like Kindle are already taking advantage of court-mandated iOS App Store changes

RSS mac surfer

  • Tot is new text editor for Mac, iPhone, and iPad focused on constraints and ease of use
  • TiPbITS: Google Drive Sorting Can Hide New Documents
  • How to take a screenshot on a MacBook Pro
  • How To Create Simple Animation With Mac Keynote
  • Last Week on My Mac: Virus pandemics

Donate

Copyright © 2025· Neil Gee - All Rights Reserved - Hosted by Runcloud

Copyright © 2025 · gee on Genesis Framework · WordPress · Log in