Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jasperf/2f334dffdc6430564c8c to your computer and use it in GitHub Desktop.
Save jasperf/2f334dffdc6430564c8c to your computer and use it in GitHub Desktop.
Setting up Roots 8.0 (Sage) on a a Mac with Local Yosemite OSX Server and AMP. This includes setting up the server part of things #roots #wordpress #osx

First time server setup

####Git (Installed on OSX),

/usr/bin/git
~ jasper$ git --version
git version 1.9.3 (Apple Git-50)```
####Ruby (Installed on OSX)
```ruby --version
ruby 2.0.0p481 (2014-05-08 revision 45883) [universal.x86_64-darwin14]```
#### PHP (Installed on OSX)

```php --version
PHP 5.5.14 (cli) (built: Sep  9 2014 19:09:25) 
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies```
#### Apache2 (Installed On OSX)

Add virtual Host file details below to create vhosts on the fly. Localhost is added to revive it after DocumentRoot was changed

    <VirtualHost *:80>
    ServerName localhost
    DocumentRoot /Library/WebServer/Documents/
    </VirtualHost>
    <Virtualhost *:80>
    VirtualDocumentRoot "/Users/user/webdesign/%1"
    ServerName vhosts.dev
    ServerAlias *.dev
    UseCanonicalName Off
    LogFormat "%V %h %l %u %t \"%r\" %s %b" vcommon
    ErrorLog "/Users/user/webdesign/vhosts-error_log"
    <Directory "/Users/user/webdesign/*">
      Options Indexes FollowSymLinks MultiViews
      AllowOverride All
      Order allow,deny
      Allow from all
    </Directory>
    </Virtualhost>

Make sure you add it to ```/private/etc/apache2/extra/httpd-vhosts.conf``` and load it from the main file ```/etc/apache2/httpd.conf```

http://stackoverflow.com/questions/25250566/apache-localhost-403-error-with-yosemite

Also make sure indexes are allowed: ```sudo nano +250 /private/etc/apache2/httpd.conf``` and add ```Indexes``` at the end of that line.

Yosemite also blocks all so check  http://mallinson.ca/osx-web-development/ and make sure you read the Yosemite section

####DNS Masq for Local DNS Magic http://blakeembrey.com/articles/2012/04/local-development-with-dnsmasq/ http://passingcuriosity.com/2013/dnsmasq-dev-osx/

brew install dnsmasq

sudo launchctl load /Library/LaunchDaemons/homebrew.mxcl.dnsmasq.plist

Copy config file to proper place

```cp /usr/local/Cellar/dnsmasq/2.72/dnsmasq.conf.example /usr/local/etc/dnsmasq.conf````

mate /usr/local/etc/dnsmasq.conf

and add:

listen-address=127.0.0.1
address=/.dev/127.0.0.1

copy dameon file into place too ``sudo cp $(brew list dnsmasq | grep /homebrew.mxcl.dnsmasq.plist$) /Library/LaunchDaemons/```

add resolver

sudo mkdir -p /etc/resolver

add file dev there and add

nameserver 127.0.0.1

restart dnsmasq

sudo launchctl stop homebrew.mxcl.dnsmasq

sudo launchctl start homebrew.mxcl.dnsmasq

####WP-CLI (http://wp-cli.org/ )

curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar

php wp-cli.phar --info

chmod +x wp-cli.phar

sudo mv wp-cli.phar /usr/local/bin/wp ####Homebrew ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

brew update

brew doctor

MySQL

brew install mysql

mysql.server start

####PHPMyAdmin

brew tap homebrew/dupes
brew tap homebrew/homebrew-php
brew install phpmyadmin

phpmyadmin might need

$cfg['Servers'][$i]['host'] = '127.0.0.1'; ####Node.JS and NPM (Using Homebrew), http://thechangelog.com/install-node-js-with-homebrew-on-os-x/

brew install node

If you update npm itself, do NOT use the npm update command.
The upstream-recommended way to update npm is:
npm install -g npm@latest```
####Bower
```npm install -g bower```
####Gulp, 
```npm install -g gulp```

####Grunt (Grunt as a backup)
```npm install -g grunt```

Set up Wordpress using WP-CLI

mkdir project.com
cd project.com
wp core download
mysql -u [mysql-username] -p
# Enter MySQL password
> create database wp_projectname_YYMMDD;
> show databases; # optional - verify database exists
> create user wp_projectname;
> grant all on wp_projectname_YYMMDD.* to 'wp_projectname'@'localhost' identified by '[randompassword]';
> flush privileges;
> exit
cp wp-config-sample.php wp-config.php
# Fill in DB information and add WP_ENV Production line stated below: roots.io/roots-101
# 127.0.0.1 is probably needed with this setup instead of localhost
echo 'define('WP_ENV', 'development');' >> wp-config.php

Sage Starters Theme Setup

cd wp-content/themes/
git clone git clone https://github.com/roots/sage.git build-YYMMDD

Intial build & commit

npm install
bower install
# Check the front end website for any display issues
git add .
git commit -m "First commit"

##Available gulp commands

gulp — Compile and optimize the files in your assets directory
gulp watch — Compile assets when file changes are made
gulp --production — Compile assets for production (no source maps).

Set up a new script

bower install fullpage.js --save # Script example name: fullpage.js 
gulp build
# Refresh site in browser window and in Chrome Inspector > Sources check to see JS / CSS has loaded.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment