How to remove all packages from homebrew, distribute, macports, pip?

Over the course of the year, I became more familiar with programming on OS X, and I think that in my initial excitement, I installed a whole bunch of things that I will not use and which pollute my development environment.

In particular, I found that with pip, brew, port and easy_install, I added all kinds of packages for all kinds of versions and even for different systems (Snow Leopard and Mountain Lion).

So, now I was wondering, is it possible to start from scratch? I would prefer to store files and programs, so reinstalling the OS is not required. If there is an easy way to bulk delete packages for each of the four, this will help a lot.

Thank!

+5
source share
2 answers

pip easy_install ( , ).

, :

$ pip freeze > packages.txt

, ( ) , python .

, , , ( ), script

#!/bin/bash

for plugin in $(cat packages.txt); do
    PLUGIN=$(echo "$plugin" | awk -F == '{print }')
    echo "Uninstalling $PLUGIN..."
    expect -c "spawn pip uninstall $PLUGIN
    expect {
        \"Proceed (y/n)?\" {
            send \"y\r\n\"
            expect {
                exit
            }
        }
    }"    
done

macports . .

brew, .

, , superuser.com, stackoverflow - .

- - .

+4

Linux :

$ pip freeze > args | pip uninstall -y -r args | rm args

Windows :

$ pip freeze > args | pip uninstall -y -r args | del args

-y , , -r , - args pip freeze> args

0

All Articles