require 'brewkit' class Postgresql = 10.6 && Hardware.is_64_bit? configure_args << "ARCHFLAGS='-arch x86_64'" end # Fails on Core Duo with O4 and O3 if Hardware.intel_family == :core ENV.O2 end system "./configure", *configure_args system "make install" (prefix+'org.postgresql.postgres.plist').write startup_plist end def skip_clean? path # NOTE at some point someone should tweak this so it only skips clean # for the bits that break the build otherwise true end def caveats; <<-EOS If this is your first install, create a database with: #{HOMEBREW_PREFIX}/bin/initdb #{HOMEBREW_PREFIX}/var/postgres Automatically load on login with: launchctl load -w #{prefix}/org.postgresql.postgres.plist Or start manually with: #{HOMEBREW_PREFIX}/bin/pg_ctl -D #{HOMEBREW_PREFIX}/var/postgres -l #{HOMEBREW_PREFIX}/var/postgres/server.log start And stop with: #{HOMEBREW_PREFIX}/bin/pg_ctl -D #{HOMEBREW_PREFIX}/var/postgres stop -s -m fast If you want to install the postgres gem, include ARCHFLAGS in the gem install to avoid issues: env ARCHFLAGS="-arch x86_64" gem install postgres To install gems without sudo, see the Homebrew wiki. EOS 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`} WorkingDirectory #{HOMEBREW_PREFIX} EOPLIST end end