Archives

All posts for the month July, 2014

install-postgresql-934-on-mac

PostgreSQL is a pretty common database choice these days. It’s quick and fairly easy to set up but a lot of the information I’ve seen online makes it much harder than it has to be so I’m going to put my notes here.

  1. Download PostgreSQL and follow the installation guide for your flavor
  2. Fire up your console and type $ psql to open the Postgres command line
    1. From here you should do all of the commands you find online
    2. Everything you find on http://www.postgresql.org/docs/ will work in the command line
    3. This will be your main interaction between you and your PostgreSQL databases
  3. Create a Database – CREATE DATABASE my_new_database
  4. Read the docs and do some Google searches to find all of the commands you’ll need. There are way too many to list here and they all have their uses.

That should get you up and running. If you are doing a web development project your web framework would probably take over from here once you have your databases created. Django would create tables on its own, especially with South or 1.7 with migrations. Ruby on Rails could create tables using $ rake db:create or for more developed projects $ rake db:schema:load.

As usual if there is anything I’ve missed or questions that you have feel free to leave a comment below.

Installing Rails on Mac OSX

rails

When developing for Ruby on Rails the first thing you’ll need to set up your development environment. This guide will be for installing things on Mac OSX and would be similar for Linux. These are my notes from experience setting up a Rails environment based on The Rails Tutorial by Michael Hartl.

New Rails Installation on OSX

Install Git

Checks if git is installed and if it isn’t it will install it

Install Ruby (Already installed)

Checks Ruby version, already installed on OSX

Install RVM

RVM is for multiple Ruby on Rails environments for different projects.

Install RVM Requirements

NOTE: RVM tries to install gcc46 which is an older version of gcc on OSX. Mavericks already has gcc installed so install the list that appears except gcc. It also can install but take a VERY long time so just be patient and see.

Tell RVM where OpenSSL is

Create .gemrc

This file stops the installation of Ruby docs, the text below goes in .gemrc

Install Rails

You should be ready to create your environment and install your Gems. If I’ve missed anything, or you have problems, let me know in the comments below and I will update this list.