The PEAR installer has no option to remove all packages from a channel at once. So I’ve crafted a small shell script for that task:

#!/bin/bash
CHANNEL_NAME="THE NAME"

for pkg in $(pear list -c "$CHANNEL_NAME"  \
| awk '{if ( $2 ~ /([0-9]+)\.([0-9]+)\.([0-9]+)/ ) print $1}') ; do 
    pear uninstall "$CHANNEL_NAME/$pkg"
done

2 Responses to “Remove all packages from a pear channel”

  1. EvilBart Says:

    should be:

    pear uninstall ${CHANNEL_NAME}/“$pkg“

  2. thorsten Says:

    Sure, you are right! thanks!

Leave a Reply