Skip to content

Instantly share code, notes, and snippets.

@JasonGiedymin
Created November 18, 2011 20:33
Show Gist options
  • Save JasonGiedymin/1377670 to your computer and use it in GitHub Desktop.
Save JasonGiedymin/1377670 to your computer and use it in GitHub Desktop.
Easy PostgreSQL Start/Stop Rake tasks for OSX
#
# Don't want to run PostgreSQL as a service? Want to manually start and stop it?
# >> bundle exec rake postgresql:mac:start
# >> bundle exec rake postgresql:mac:stop
#
namespace :postgresql do
namespace :mac do
desc "Starts a Mac brew installed Postgres DB."
task :start do
result = %x[pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start]
puts result
end
desc "Stops a Mac brew installed Postgres DB."
task :stop do
result = %x[pg_ctl -D /usr/local/var/postgres stop -s -m fast]
puts result
end
desc "64bit pg gem install"
task :install64bit do
puts 'Manually run this command for native 64bit pg gem install:'
puts 'env ARCHFLAGS="-arch x86_64" gem install pg'
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment