require 'formula' class Postgresql = 10.6 && Hardware.is_64_bit? end def caveats caveats = <<-EOS If this is your first install, create a database with: initdb #{HOMEBREW_PREFIX}/var/postgres Automatically load on login with: launchctl load -w #{prefix}/org.postgresql.postgres.plist Or start manually with: pg_ctl -D #{HOMEBREW_PREFIX}/var/postgres -l #{HOMEBREW_PREFIX}/var/postgres/server.log start And stop with: pg_ctl -D #{HOMEBREW_PREFIX}/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 #{HOMEBREW_PREFIX}/bin/postgres -D #{HOMEBREW_PREFIX}/var/postgres -r #{HOMEBREW_PREFIX}/var/postgres/server.log RunAtLoad UserName #{`whoami`.chomp} WorkingDirectory #{HOMEBREW_PREFIX} EOPLIST end end