Created
February 18, 2013 07:49
-
-
Save rapimo/4975729 to your computer and use it in GitHub Desktop.
according to http://nextmarvel.net/blog/2011/09/brew-install-postgresql-on-os-x-lion/
this script moves your OS X default postgres binaries into an archive folder and symlinks the homebrew versions in place of them
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
#!/bin/sh | |
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