EDIT1: Updated for Yosemite (10.10)
EDIT2: Updated for El Capitan (10.11). Untested on 10.10 & 10.9
Xcode command line tools
We need the xcode command line tools to compile stuff. So
Accept the dialog box to install the tools. You may download XCode from the App Store if needed.
oh-my-zsh
Zsh has some nifty features over bash, particularly the recursive globbing.
Homebrew
It’s nice to have a package manager do the work.
Now that homebrew is up and running, let’s get some tools and apps. The below linked gist can be downloaded as a shell script and executed. While you’re at it, you can add your own tools and apps to the list.
Git setup
copy ssh key to github.com
copy ssh key to clipboard, add it to your ssh keys on github and bitbucket.
test connection
set git config values
Node
Node and npm can be installed with homebrew. Node now comes with npm.
Fix permissions to allow installation without sudo.
Install grunt and bower
Nginx
Install nginx
Next change nginx port to default http port 80
from
to
Now let’s get it running
DNSMasq
Dynamic virtual hosts
Now that we have installed dnsmasq to resolve domains ending with .dev to point to 127.0.0.1, let’s configure nginx to dynamically configure virtual hosts.
I configured my nginx to use /Users/varun/Sites folder as webroot.
Now let us say I have my websites in this order
~/Sites
~/Sites/portfolio
~/Sites/survey
~/Sites/portal
We have to create a separate folder for all our sites.
Since that is done, we have to tell nginx about the locations. Edit the nginx.conf and include the follwing line in the http {} section
Now, let’s put in a default config. I’ve a gist which we’ll make some changes to.
Next, we’ll put in a config that’ll resolve all .dev domains to the respective folders in /Users/yourusername/Sites folder.
We now enable the config by using a symlink.
Now just restart your nginx service, and you are good to go.
Accessing your local website is automatic now.
~/Sites
--
localhost
~/Sites/portfolio
--
portfolio.dev
~/Sites/survey
--
survey.dev
~/Sites/portal
--
portal.dev
MariaDB
brew install mariadb
Install databases
Now start mysql server
Change root password and remove test databases. The default password is either root or there is no password, just hit return.
Start mariadb on boot
PHP
Add php-fpm configuration to the file at /usr/local/etc/nginx/conf.d/php-fpm