Install brew under Lion?

To give an early Macbook Air from 2010 some useful tasks, a package manager is needed. The basic requirement is always Xcode 4.6.3 (from 2013) while also the command line tools are necessary.

Using some code from an earlier script I wrote

XC=xc.dmg
DMGURL=https://download.developer.apple.com/Developer_Tools/xcode_4.6.3/xcode4630916281a.dmg
curl "$DMGURL" -o "$XC"
DMGURL=http://devimages.apple.com/downloads/xcode/command_line_tools_for_xcode_os_x_lion_april_2013.dmg
TOOLS=cltools.dmg
curl "$DMGURL" -o "$TOOLS"

Then install Xcode, then Commandline Tools as an untrusted package.

TMPMOUNT=`/usr/bin/mktemp -d /tmp/clitools.XXXX`
hdiutil attach "$TOOLS" -mountpoint "$TMPMOUNT" -nobrowse
sudo installer -allowUntrusted -pkg "$(find $TMPMOUNT -name '*.mpkg')" -target /
hdiutil detach "$TMPMOUNT"
rm -rf "$TMPMOUNT"
rm "$TOOLS"

So far so good. Then I installed

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

and run several “brew update” and “brew doctor” which failed due to SSL errors. Only macport worked perfect and compiled all my sources (fswatch….).