Open Terminal application located in directory Applications/Utilities/ then Copy-&-Paste(or type) the following commands in the grey boxes.
Install Command Line Tools
This adds extra features to your terminal.
ruby -e “$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
This downloads and installs home-brew.
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.
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
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
mysql_install_db --verbose --user=`whoami` --basedir="$(brew --prefix mysql)" --datadir=/usr/local/var/mysql --tmpdir=/tmp
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.
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'
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
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.
Options Indexes FollowSymLinks Includes ExecCGI
Allow from all
# 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
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.
Install autoconf and mcrypt
brew install autoconf mcrypt
curl -sS https://getcomposer.org/installer | php
mv composer.phar /usr/local/bin/composer
Composer is a tool for dependency management in PHP.
brew install mongodb
This is a nosql database.