MacOSX(10.9) で postgresql インストールから heroku open まで
heroku 使いたくて〜
メモしていきます
https://toolbelt.heroku.com/osx
・herokuコマンドをインストールする
http://morizyun.github.io/blog/heroku-rails4-postgresql-introduction/
・この手順を参考に
[bash]
//postgresqlは未インストールを確認
$ brew list
apple-gcc42 freetype imagemagick libgpg-error libpng mysql pkg-config readline
autoconf git-flow jpeg libksba libtool openssl rbenv ruby-build
//インストール
$ brew install postgresql
//DB初期化
$ initdb /usr/local/var/postgres -E utf8
//DBスタート
$ pg_ctl -D /usr/local/var/postgres -l logfile start
//確認
$ psql -l
//自動起動
$ ln -sfv /usr/local/opt/postgresql/*.plist ~/Library/LaunchAgents
$ launchctl load ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
//gem pg は入ってないことを確認
$ gem list | grep pg
//gem pg のインストール方法がみれるのでみとく
$ brew info postgresql
//以下のようにしろと
$ ARCHFLAGS="-arch x86_64" gem install pg
Building native extensions. This could take a while...
Successfully installed pg-0.17.0
invalid options: -f fivefish
(invalid options are ignored)
Parsing documentation for pg-0.17.0
unable to convert "\xCF" from ASCII-8BIT to UTF-8 for lib/pg_ext.bundle, skipping
Installing ri documentation for pg-0.17.0
1 gem installed
//DB接続用のユーザーを作成する(-dがcreatedatabaseの権限付与)
$ createuser -P hoge -d
Enter password for new role:
Enter it again:
//railsのバージョン確認
$ rails --version
Rails 4.0.0
$ rails new hoge --database=postgresql --skip-test-unit --skip-bundle
$ bundle install
$ wget https://raw.github.com/svenfuchs/rails-i18n/master/rails/locale/ja.yml -P config/locales/
$ bundle exec rake RAILS_ENV=development db:create
とりあえず rails s -p 5000 とかでposgresqlに接続できることを確認しておく
$ heroku create hoge
$ git push heroku master
$ heroku run rake db:migrate
$ heroku open
[/bash]
heroku の ssh周りで困ったら以下