Coolestguidesontheplanet.com | Neil Gee

coolest guides on the planet

Coolest Guides On The Planet

Neil Gee

  • Home
  • macOS
  • WebDev
  • All Posts
  • Contact

Installing PEAR on OSX 10.11 El Capitan

March 7, 2016 1 Comment

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

 

Share this:

  • Twitter
  • Google
  • Facebook

Related

Cats: macOS, WebRoot

  • Pingback: Installing PEAR on OSX 10.9 Mavericks and OSX10.8/10.7()

Subscribe

Coolest Guides on the Planet
  • Latest
  • Popular
  • Comments
  • Setting up a Local Development WordPress Environment on Mac OSX Setting up a Local Development WordPress Environment on Mac OSX
  • Sync’ing a GitHub Fork via the Command Line Sync’ing a GitHub Fork via the Command Line
  • Remove MySQL instance from macOS or OSX via the command line Remove MySQL instance from macOS or OSX via the command line
  • Set Up Let’s Encrypt SSL on cPanel WHM Server Set Up Let’s Encrypt SSL on cPanel WHM Server
  • Compare the diff of 2 folders in the Command Line Compare the diff of 2 folders in the Command Line
  • Today Week Month All
  • Jetpack plugin with Stats module needs to be enabled.
  • Today Week Month All
  • Sorry. No data yet.
Ajax spinner

Tags

apache backup baseband Bing boot Coolest Guy on the Planet Coolest Guy Planet cpanel css custom database drupal el capitan error Firmware Google image instadmg ios iphone jailbreak keys Keywords lion mac mysql OSX PageRank php private public Rank Rank Checker ranking redirect remote rsa SEO SERPS shell ssh terminal Twitter unstoppables Yahoo
WordPress Workflow
Get DesktopServer
StudioPress Premium WordPress Themes

Donate a Beer to the Coolest Guides

Copyright © 2016· Neil Gee - All Rights Reserved - Hosted by Servint