Python 2.7 via Homebrew

I missed the memo, but back in January Homebrew announced that as of version 1.5, python would be upgraded to use Python 3.x. This change went live on March 1, and I noticed it over the weekend while tinkering with Homebridge.

While I was rebuilding Homebridge with the latest version of Node.js, I kept banging into node-gyp errors having to do with using Python 3.x. I’m not alone, though there is already a pull request to fix this issue.

For the time being, I’ve made two changes to please node-gyp:

  1. Forced a link of the new python@2 keg1:

    brew link python@2 -f
    
  2. Added the following to my ~/.bash_profile, so that python will point at python2:

    export PATH="/usr/local/opt/python@2/libexec/bin:$PATH"
    

I think I’ll revert the second change once the node-gyp issue is resolved, to begin forcing myself to use Python 3.x.