require 'formula' require 'hardware' class Postgresql = 10.6 && Hardware.is_64_bit? end def caveats caveats = <<-EOS If this is your first install, create a database with: initdb #{var}/postgres Automatically load on login with: launchctl load -w #{prefix}/org.postgresql.postgres.plist Or start manually with: pg_ctl -D #{var}/postgres -l #{var}/postgres/server.log start And stop with: pg_ctl -D #{var}/postgres stop -s -m fast EOS if bits_64? then caveats << <<-EOS If you want to install the postgres gem, including ARCHFLAGS is recommended: env ARCHFLAGS="-arch x86_64" gem install postgres To install gems without sudo, see the Homebrew wiki. EOS end caveats end def startup_plist return <<-EOPLIST KeepAlive Label org.postgresql.postgres ProgramArguments #{bin}/postgres -D #{var}/postgres -r #{var}/postgres/server.log RunAtLoad UserName #{`whoami`.chomp} WorkingDirectory #{HOMEBREW_PREFIX} EOPLIST end end