I like Ruby, but I don’t like its per­for­mance, so I’m really antic­i­pat­ing Ruby 2.0. Mean­while, I’ve been dab­bling in Python. Learn­ing a new lan­guage and com­par­ing and con­trast­ing them, really helps with deter­min­ing each language’s strengths and weak­nesses. For exam­ple, you can eas­ily update all your Ruby gems. Unfor­tu­nately, python doesn’t have a direct way of doing this using easy_install. Very odd. I tried using the shell script method, but for what­ever rea­son it just didn’t work as adver­tised. So I wrote a bash alias to take care of it.

alias easy_install_upgrade_all='python -c "for dist in __import__('\''pkg_resources'\'').working_set: print dist.project_name" | while read package; do sudo easy_install -U "${package}" ; done'

Put that alias in your ~/.bash_aliases file, run exec bash, and you should be good to go (assum­ing your .bashrc file is setup to auto­mat­i­cally load your .bash_aliases file). Note the use of escaped single-quotes around “pkg_resources”.

One Response to “Easy_Update Upgrade All”

  1. Leon Bogaert said on September 26th, 2009 at 12:05 pm:

    Thanks for this tip, it’s very handy!