wordbotch.com

Blog


OS X development environment

Recently I upgraded my iMac to Sierra. The most annoying thing about upgrading is that every time I do, any system files I've modified get overwritten. This is most noticeable in the case of the Apache server, which requires some messing about in /etc to configure.

Normally it's just a bit of a pain, but this time something went wrong and I had to do a clean install. So, future me reading this: don't screw it up again, K?

What went wrong

No idea. Probably something PHP-related. Was all going great until I tried upgrading to PHP7. Initially tried the brew version:

> brew install php70
Then I couldn't work out where libphp7.so was. Then I read the fine print:
> brew info php70
Turns out homebrew doesn't build PHP for apache by default.
> brew uninstall php70
> brew install php70 --with-apache

Followed the rest of the brew instructions to get Apache using PHP 7 by modifying httpd.conf, and still couldn't get it working. So I tried installing php7 from here instead. Not really sure what went wrong, but soon thereafter Apache stopped working properly. I still got the default page, but that's about it. PHP files weren't being interpreted and virtual hosts were ignored. I also noticed that restarting the machine now always failed, hanging forever, so needed to use the power switch.

Installation USB drive

Followed instructions here to make a bootable USB drive. First one wasn't recognised on boot, so tried following instructions here to reset PRAM. Still didn't work, so tried another drive, which did.

Backup

Ok future me, if you do need a clean install, remember to back up:

  • Applications
  • home directory
  • /etc/apache2
  • /etc/hosts

Make especially sure you copy .vimrc and .inputrc from home directory. Here are my versions of them, for when I lose them.

.vimrc

set nocompatible
set autoindent
set smartindent
set incsearch
set ignorecase
set tabstop=4
set shiftwidth=4
set expandtab
syntax on
colorscheme koehler

.inputrc

set completion-ignore-case On
set bell-style: Off

Clean Install

Restart holding option key, select USB drive for launch when prompted. Follow instructions.

Setup

Basics

Copy over .vimrc, .inputrc
Copy over required stuff from home directory
Open App Store & install XCode
Install Chrome
Install Atom

Homebrew

Go to Homebrew site and follow instructions.

More stuff

> brew install macvim
> brew install node
> brew install npm
> npm install -g bower
> sudo pip install selenium

Apache

Set up Apache
Set up virtual hosts

MySQL

Install MySQL

Remove root password:
> mysql -u root -p
# enter temporary password
> ALTER USER 'root'@'localhost' IDENTIFIED BY ''
Install Sequel Pro

Migrate any databases
> mysql -u root -D'some_db' < /some/sql/file.sql

And I still haven't got PHP7 working...