11
11

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

HomebrewでPostgresql9.1から9.3へアップデート

Last updated at Posted at 2013-10-15

きちんとバックアップとってる人は Upgrading from PostgreSQL 9.1.x to 9.2.x with Homebrew ここに書いてある通りやるだけ。

zsh
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 upgradeをバックアップせずやっちゃううっかりさんのために。

古いバージョン (Postgresql 9.1)のインストール

ここによると、Homebrew install specific version of formula? - Stack Overflow homebrew-versions という機能が追加されている。

1) homebrew-versionsの機能を有効にする

zsh
➜  ~  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) インストールできるバージョンの確認

zsh
➜  ~  brew search postgresql
postgresql     postgresql8    postgresql9    postgresql91   postgresql92

3) インストール

zsh
➜  ~  brew install postgresql9

4) アップデートする

冒頭の通りです。

勘所

homebrew-versionsすげー便利。種類も豊富。
Homebrew/homebrew-versions

11
11
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
11
11

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?