Created
April 23, 2013 21:32
-
-
Save leostratus/5447581 to your computer and use it in GitHub Desktop.
Moves your OS X default postgres binaries into an archive folder and symlinks the homebrew versions in place of them.
Originally from http://nextmarvel.net/blog/2011/09/brew-install-postgresql-on-os-x-lion/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BREW_POSTGRES_DIR=`brew info postgres | awk '{print $1"/bin"}' | grep "/postgresql/"` | |
LION_POSTGRES_DIR=`which postgres | xargs dirname` | |
LION_PSQL_DIR=`which psql | xargs dirname` | |
sudo mkdir -p $LION_POSTGRES_DIR/archive | |
sudo mkdir -p $LION_PSQL_DIR/archive | |
for i in `ls $BREW_POSTGRES_DIR` | |
do | |
if [ -f $LION_POSTGRES_DIR/$i ] | |
then | |
sudo mv $LION_POSTGRES_DIR/$i $LION_POSTGRES_DIR/archive/$i | |
sudo ln -s $BREW_POSTGRES_DIR/$i $LION_POSTGRES_DIR/$i | |
fi | |
if [ -f $LION_PSQL_DIR/$i ] | |
then | |
sudo mv $LION_PSQL_DIR/$i $LION_PSQL_DIR/archive/$i | |
sudo ln -s $BREW_POSTGRES_DIR/$i $LION_PSQL_DIR/$i | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment