The easiest way to use Postgresql on Mac is to download and install the Postgres.app. With Postgresql running, add gem 'pg' to the Gemfile in your rails project and run bundle install to install the Postgresql Ruby driver. This RailsCast talks about how to set up with Postgres in detail. You can skip the “taps” part if you don’t already. In this guide, we used a simple Rails app to demonstrate how azk automates our application environment setup tasks. This makes it easy to deploy the same application in multiple environments. If you like azk’s deployment process, consider using it for your own project or adding an Azkfile to a fork of another open-source project.
- Deploy Rails App To Heroku
- Deploy Rails App Mac Download
- Deploy Rails App
- Deploy Rails App Mac Pro
- Deploy Rails App To Heroku
A brief note on how to install and setup PostgreSQL for Ruby on Rails on Mac OS.
- Install PostgreSQL
- Install pgAdmin
![Rails Rails](/uploads/1/3/4/1/134148954/459423634.png)
Prerequisites
This note assumes that Ruby on Rails has already been properly installed and the purpose is to replace the default DB engine SQLite with PostgreSQL.
Install PostgreSQL
How to share app from mac to mac os. As shown in the official Postgres download instructions here, there are few ways of installing PostgreSQL on Mac OS. Homebrew or Postgres.app are the common ones that often recommeded by other Mac users.
However, as I also use Linux and Windows machines for development, installing PostgreSQL using grapichal installer from EnterpriseDB would be a more widely used solution that keeps everything consistent across all my environment. This grapichal installer provides an easy and straightforward wizard to get Postgres installed with few simple clicks.
Download
- Go to https://www.enterprisedb.com/software-downloads-postgres
- Select a version. (For example, the latest installer version is
Version 9.4.0
). - Click 'Mac OS X' to download for Mac.
Install
- Install from the downloaded file
postgresql-9.4.0-1-osx.dmg
just like any other Mac installers. - Follow through the installation wizard with the default options.
- Installing Stack Builder is optional and can be omitted.
Add to PATH
- Locate where PostgreSQL's binary is. By default, it should be
/Library/PostgreSQL/9.4/bin/psql
, where 9.4 is the PostgreSQL version number. https://everdocs475.weebly.com/blog/zenkit-app-for-mac. Otherwise, use the followingfind
command to find the path.sudo find / -name 'psql' - Open
~/.bash_profile
with following command.open ~/.bash_profile - Add the following line to
.bash_profile
using the PostgreSQL's binary path.PATH=$PATH:/Library/PostgreSQL/9.4/bin
Install pgAdmin
pgAdmin is the most popular and feature rich Open Source administration and development platform for PostgreSQL. It helps users manage PostgreSQL databases through graphical interfaces.
Install
- Download Mac OS dmg installer from https://www.pgadmin.org/download/macos4.php.
- Install it (e.g. the latest is
pgadmin3-1.20.0.dmg
).
Connect to server
- Open up pgAdmin III from the applications.
- The local DB should be already shown up in Obeject Browser -> Server Groups -> Servers -> PostgreSQL 9.4 (localhost:5432). If not, manually add a server pointing to
localhost:5432
or the port number specified when installing PostgreSQL.
Install pg gem
- Open up a terminal window
- Find out where
pg_config
is using the command below. By default, it should be/Library/PostgreSQL/9.4/bin/pg_config
for PostgreSQL 9.4.sudo find / -name 'pg_config' - Install the gem with
pg-config
path explicitly specified.gem install pg -- --with-pg-config=/Library/PostgreSQL/9.4/bin/pg_config
Update Ruby on Rails project
- Update 'Gemfile'. Replace
gem 'sqlite3'
withgem 'pg'
. - Run
bundle install
. - Open
config/database.yml
file and update it like the following:
![Deploy Deploy](/uploads/1/3/4/1/134148954/203589164.png)
Original (for SQLite):
New (For PostgreSQL):
Deploy Rails App To Heroku
Create DB using PostgreSQL
rake db:create && rake db:migrate Best checklist app mac pro.
Further Reading
Setting Up A Database
Rails ships with sqlite3 as the default database. Chances are you won't want to use it because it's stored as a simple file on disk. You'll probably want something more robust like MySQL or PostgreSQL.
There is a lot of documentation on both, so you can just pick one that seems like you'll be more comfortable with.
https://everdocs475.weebly.com/blog/rapid-compression-app-mac. If you're new to Ruby on Rails or databases in general, I strongly recommend setting up PostgreSQL.
If you're coming from PHP, you may already be familiar with MySQL.
MySQL
You can install MySQL server and client from Homebrew:
Once this command is finished, it gives you a couple commands to run. Follow the instructions and run them:
Deploy Rails App Mac Download
By default the mysql user is
root
with no password.When you're finished, you can skip to the Final Steps.
PostgreSQL
Deploy Rails App
You can install PostgreSQL server and client from Homebrew:
Deploy Rails App Mac Pro
Once this command is finished, it gives you a couple commands to run. Follow the instructions and run them:
Deploy Rails App To Heroku
By default the postgresql user is your current OS X username with no password. For example, my OS X user is named
chris
so I can login to postgresql with that username.