LoginSignup
1
1

More than 5 years have passed since last update.

自分のMac(El Capitan)にbrew install postgresをしたけどうまくできなかったので備忘録

Posted at

こちらを参考にさせていただきまして macにpostgres環境を作ろうとしました。

$ brew install postgres

このコマンドでbrewにはインストールできましたが、
インストール中に Error linkって出てきていたのが気になっては
いましたが、最後までそれ以外エラーがなく入ったので進めようとしていました。

$ initdb -D /usr/local/var/postgres

初期化?を先ほどの記事にしたがってしようとしたらどう
$ -bash: initdb: command not found のようなコマンドがない?
これは??の状態ですすめませんでした。

その後、色々調べているとHomebrewにはインストール済みのものに問題がないか調べてくれる
コマンドあるらしいとわかった

$ brew doctor

この実行で以下


:
:
those kegs to fail to run properly once built. Run `brew link` on these:
  git
  libpng
  mercurial
  postgresql
:
:

brew linkやっぱりlinkされていない!?
ということがわかった。

そうなれば、この内容でググってみると
こちらのサイトで説明あったのでしたがってやってみました。

$ brew link postgresql

linkをさせる?ためのコマンドだと思うのですが、これでどうだ!?っとやると
今度は、


Error: Could not symlink share/man/man7/ABORT.7

う〜ん、またエラーか。
さらにこちらで対処法をみつけた

sudo chown -R $USER man7

以下コマンドで実行権限をつけてあげて進められた


cd /usr/local/share/man
sudo chown -R $USER man7
brew link --force postgres

これでようやくpostgresがlinkされた!!
さあ次だ!


$ initdb -D /usr/local/var/postgres

初期化された!さあ!
と進めると
その先のユーザー登録の際


$ createuser -P postgres

またエラー

connections on Unix domain socket "/tmp/.s.PGSQL.5432"?

ここでも謎のエラーだったので検索する
ここでわかった

fixBrewLionPostgresql.shファイル

以下コマンドでローカル上でもpostgresがつかえるようになりました!


$ cd /usr/local/Cellar/postgresql
$ curl -o fixBrewLionPostgresql.sh http://nextmarvel.net/blog/downloads/fixBrewLionPostgres.sh
$ chmod 777 fixBrewLionPostgresql.sh
$ ./fixBrewLionPostgresql.sh
$ pg_ctl -D /usr/local/var/postgres start

以上、いろいろ苦労したけど これでpostgres練習できそう。
ただ、どうしてこうなっているのか内容がイマイチ理解不足なので勉強しないと

1
1
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
1
1