在Homebrew中从Postgresql9.1升级到9.3
只要按照这里写的,从PostgreSQL 9.1.x升级到9.2.x使用Homebrew的人都会进行正确的备份。
brew update
brew upgrade postgresql
launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
mv /usr/local/var/postgres /usr/local/var/postgres91
initdb /usr/local/var/postgres -E utf8
pg_upgrade \
-b /usr/local/Cellar/postgresql/9.1.x/bin \
-B /usr/local/Cellar/postgresql/9.2.x/bin \
-d /usr/local/var/postgres91 \
-D /usr/local/var/postgres
cp /usr/local/Cellar/postgresql/9.2.x/homebrew.mxcl.postgresql.plist ~/Library/LaunchAgents/
launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
为了像我一样不小心不备份就升级brew的朋友们。
安装旧版本(Postgresql 9.1)
据这里的情况,Homebrew添加了一个名为homebrew-versions的功能,它可以安装特定版本的 Formula。
启用homebrew-versions的功能
➜ ~ brew tap homebrew/versions
Cloning into '/usr/local/Library/Taps/homebrew-versions'...
remote: Counting objects: 1277, done.
remote: Compressing objects: 100% (783/783), done.
remote: Total 1277 (delta 694), reused 1036 (delta 494)
Receiving objects: 100% (1277/1277), 339.55 KiB | 244.00 KiB/s, done.
Resolving deltas: 100% (694/694), done.
Checking connectivity... done
Tapped 117 formula
2) 确认可安装的版本
➜ ~ brew search postgresql
postgresql postgresql8 postgresql9 postgresql91 postgresql92
3)安装
➜ ~ brew install postgresql9
4) 进行更新
正如开头所说。
检查的地方
在中文中,Homebrew/homebrew-versions非常方便且种类丰富。