Mac+HomeBrew+Postgresql+pg
Macã§Postgresqlã使ããã¨ãã¦ã¯ã¾ã£ããã¨ãã¡ã¢ã
Posgtgresqlã®ã¤ã³ã¹ãã¼ã«
HomeBrewãå°å ¥ãã¦ããã®ã§ã¤ã³ã¹ãã¼ã«èªä½ã¯ä¸è¨ã®ã³ãã³ãã§ä¸çºã
$ brew install postgresql
Postgresqlã®èµ·åã¨çµäº
ã¾ãã¯èµ·åã
pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start
次ã«çµäºã
pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start
èªåã§èµ·åããå ´åã¯ãä¸è¨ã®ã³ãã³ããå®è¡ããã
$ launchctl unload -w ~/Library/LaunchAgents/org.postgresql.postgres.plist $ cp /usr/local/Cellar/postgresql/9.0.4/org.postgresql.postgres.plist ~/Library/LaunchAgents/ $ launchctl load -w ~/Library/LaunchAgents/org.postgresql.postgres.plist
ã¦ã¼ã¶ã®ä½æ
Railsã¢ããªç¨ã®DBæ¥ç¶ã¦ã¼ã¶ãä½æãã
$ createuser -P app_name # ãã¹ã¯ã¼ãã¨ã¹ã¼ãã¼ã¦ã¼ã¶ã«ãããã©ãããå ¥åãã
確èªã¯ä¸è¨ã®ã³ãã³ãã§ã§ããã
psql -q -c'select * from pg_user' postgres
Postgresqlã«æ¥ç¶ããããã®RubyGemsã®pgãã¤ã³ã¹ãã¼ã«ãã
ããã§ã¤ã³ã¹ãã¼ã«æ¹æ³ãééã£ã¦ã¯ã¾ã£ãã
åç´ã«ãgem install pgãã§ã¯ã ãã
rake db:createã¨ãããã¨ãPermission Deniedãã§æãããã
調ã¹ããHomeBrewããä¸å¯§ã«èª¬æããã¦ããããããã
$ brew info postgresql # æç² If you want to install the postgres gem, including ARCHFLAGS is recommended: env ARCHFLAGS="-arch x86_64" gem install pg
ããã ãorz
ããããã®ã¾ã¾å®è¡ããã
$ env ARCHFLAGS="-arch x86_64" gem install pg
rakeéã£ããã»ã»ã»ã
ã¡ãªã¿ã«ãbundlerã®å ´åã©ããããã ããï¼