Web Developer’s Environment :
A Fresh Start On OS X Mavericks.

Before starting anything I need to install Spotify, just can’t function(){} without my music.


Open Terminal application located in directory Applications/Utilities/ then Copy-&-Paste(or type) the following commands in the grey boxes.

Install Command Line Tools

xcode-select --install 

This adds extra features to your terminal.


Install Homebrew

ruby -e “$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"

This downloads and installs home-brew.


Install Git

brew install git

This downloads and installs Git.

Connect your GitHub account

git config --global user.name "Github Username"
git config --global user.email "Github Email"

Add your GitHub username and email to git.


Make Terminal fun with Dotfiles.

git clone https://github.com/mathiasbynens/dotfiles.git && cd dotfiles && source bootstrap.sh

I use Mathias Bynens’ Dotfiles, this makes my life easier.

Make Terminal pretty with Themes.

git clone https://github.com/ahmetsulek/flat-terminal.git

I use Flat-Terminal Theme, it’s easy on the eyes.

After running that command go to Terminal > Preferences then click on the Settings tab and Import Flat.terminal file located in Flat-Terminal/ directory.

Now select Startup tab and On startup, open: (select) Flat then Quit and Relaunch Terminal.

Your Terminal window should now look like this.


Make Sure Everything is Working

brew doctor

If you get Warning: /usr/bin occurs before /usr/local/bin.
Run the command below to fix it, then Quit and Relaunch Terminal.
Run the brew doctor command again to see if the warning is gone.

echo ‘export PATH=”/usr/local/bin:$PATH”’ >> ~/.bash_profile

If you get Warning: You have a curlrc file you can just ignore it.


Install MySQL with Homebrew

brew install mysql
unset TMPDIR
mysql_install_db --verbose --user=`whoami` --basedir="$(brew --prefix mysql)" --datadir=/usr/local/var/mysql --tmpdir=/tmp
mysql.server start

You can get MySQL info with this command.

brew info mysql

Launch start mysql at login:

ln -sfv /usr/local/opt/mysql/*.plist ~/Library/LaunchAgents

Add your mysqladmin password where it says yourpassword keep the single quotes.

mysqladmin -u root password 'yourpassword'

Remember this password for our MySQL management application.


Apache Start, Stop and Restart

sudo apachectl start
sudo apachectl stop
sudo apachectl restart

Start up apache, to know if it’s working go to http://localhost and it should say “It works!”.


Set up our Localhost to Domain Names

Instead of using http://localhost let’s set it so that you can use whatever domain you like.

sudo nano /private/etc/hosts

Edit this document and and add-on a domain name, I used my.dev.
Save this file with (Control+X) then (y) and now (enter).
Go to http://main.dev to see if it works.


Install DNSMASQ

This tool allows wildcard subdomain names like any-name.dev

brew install dnsmasq
mkdir -pv $(brew --prefix)/etc/
echo 'address=/.dev/127.0.0.1' > $(brew --prefix)/etc/dnsmasq.conf
sudo cp -v $(brew --prefix dnsmasq)/homebrew.mxcl.dnsmasq.plist /Library/LaunchDaemons
sudo launchctl load -w /Library/LaunchDaemons/homebrew.mxcl.dnsmasq.plist
sudo mkdir -v /etc/resolver
sudo bash -c 'echo "nameserver 127.0.0.1" > /etc/resolver/dev'

Let’s see if this work’s go to http://site1.dev, http://site2.dev, http://site3.dev


Enable PHP and VirtualHost

Let’s enable a few things by editing out /private/etc/apache2/httpd.conf file.

sudo nano /private/etc/apache2/httpd.conf

Look for with (control+w)…
#LoadModule unique_id_module libexec/apache2/mod_unique_id.so
#LoadModule php5_module libexec/apache2/libphp5.so
#Include /private/etc/apache2/extra/httpd-vhosts.conf

and then remove “#” from all those lines like below.

Copy and Paste this code block at the end of the httpd.conf document, edit where it says “shak” to your username then exit and save.

# Thing that I added starts here.
<Directory “/Users/shak/Sites/”>
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Order allow,deny
Allow from all
</Directory>
# Thing that I added ends here.

Create a Local Web Root

Make a directory to put your projects in, it could also be in your Dropbox folder. I usually keep mine in a folder called Sites then in I create a folder for every project in Sites with a subfolder called public folder. For example…
/Users/shak/Sites/project1/public = http://project1.dev
/Users/shak/Sites/project2/public =
http://project2.dev
/Users/shak/Sites/project3/public =
http://project3.dev

mkdir ~/Sites
mkdir ~/Sites/testproject
mkdir ~/Sites/testproject/public

Config Our VirtualHost

Let’s edit our /private/etc/apache2/extra/httpd-vhosts.conf file.

sudo nano /private/etc/apache2/extra/httpd-vhosts.conf

Copy and Paste this code block at the end of the httpd-vhosts.conf document, edit where it says “shak” to your username then exit and save.

<VirtualHost *:80>
DocumentRoot "/Library/WebServer/Documents/"
ServerName localhost
</VirtualHost>
<VirtualHost *:80>
VirtualDocumentRoot "/Users/shak/Sites/main/public"
ServerName main.dev
UseCanonicalName Off
</VirtualHost>
<VirtualHost *:80>
VirtualDocumentRoot "/Users/shak/Sites/%1/public"
ServerName sites.dev
ServerAlias *.dev
UseCanonicalName Off
</VirtualHost>

When ever you make a folder in Sites it should be linked to the htpp://[foldername].dev
http://project1.dev
http://project2.dev
http://project3.dev

Install autoconf and mcrypt

brew install autoconf mcrypt

Download then install Sequel Pro for MySQL database management

Add the 127.0.0.1 for Host, root for Username and mysqladmin password we created earlier for Password. Hit Connect.


Install Composer

curl -sS https://getcomposer.org/installer | php
mv composer.phar /usr/local/bin/composer

Composer is a tool for dependency management in PHP.


Install MongoDB

brew install mongodb

This is a nosql database.


Install Node.js and NPM

brew install node

Node.js is written in JavaScript and it’s a cross-platform runtime environment for server-side and networking applications.

npm (Node Packaged Modules) is the official package manager for Node.js.


Download and then Install SublimeText or whatever code editor you like.

Install Package Control for SublimeText.


Start Developing!

Show your support

Clapping shows how much you appreciated Shak Daniel’s story.