Skip to content

Instantly share code, notes, and snippets.

@andresbravog
Last active January 2, 2016 22:29
Show Gist options
  • Save andresbravog/8370726 to your computer and use it in GitHub Desktop.
Save andresbravog/8370726 to your computer and use it in GitHub Desktop.
Install wp locally on mac with pow and pg

Install WordPress Locally on mac osx with pow and Postgres

1- Download pg server

Download postgress.app and run it

2- create database

Open psql, from the menubar elephant icon, and run...

CREATE DATABASE wordpress;
CREATE USER wordpress WITH PASSWORD 'wordpress';
GRANT ALL PRIVILEGES ON DATABASE wordpress to wordpress;

3- Create rvmrc for isolate gemset and ruby

rvm rvmrc create ruby-2.0.0-p353@your-wp-name
rvm rvmrc trust .rvmrc
rvm rvmrc wrning ingnore .rvmrc

4- install needed gems

gem install powder rack-legacy rack-rewrite

5- install wget (if you dont have it)

brew install wget

6- create a prowrc file

wget https://gist.github.com/soderlind/4208560/raw/2c0516b2b551ceae7eba413207010dea6f538f79/config.ru config.ru

7- Install php on your machine

brew install php55 --with-pgsql --with-cgi

8- Add you db config to your config.ru file

vi config.ru

inside the block

  script, info = *path_parts(path)
        env['SCRIPT_FILENAME'] = script
        env['SCRIPT_NAME'] = script.sub ::File.expand_path(public_dir), ''
        env['REQUEST_URI'] = env['POW_ORIGINAL_REQUEST'] unless env['POW_ORIGINAL_REQUEST'].nil?
        
+       env['DATABASE_URL'] = "postgres://wordpress:wordpress@localhost:5432/wordpress"

        super env, @php_exe, *config.flatten
      end
    end
  end

9- Run your app

powder link your-blog-url
powder open

Sources

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment