Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Setup new mac for web development (Updated for Yosemite)

##Install Xcode command line tools


Enable root if not already enabled:


Apache is already installed, just not running.

apachectl start
apachectl stop
apachectl restart

To get it to work with user directories, replace "username" with your username. The file may already be there

nano /etc/apache2/users/username.conf

Add and save this info into that file.

<Directory "/Users/username/Sites/">
    Options Indexes MultiViews
    AllowOverride All
    Options +FollowSymLinks
    Require all granted
    Allow from all

It should already have the right permissions, but if not:

chmod 644 username.conf

You may also need to create the /username/Sites directory

nano /etc/apache2/httpd.conf

Uncomment: LoadModule userdir_module libexec/apache2/ Uncomment: Include /private/etc/apache2/extra/httpd-userdir.conf

nano /etc/apache2/extra/httpd-userdir.conf 

Uncomment: Include /private/etc/apache2/users/*.conf

apachectl restart

Now go to http://localhost/~username and it should work. Drop in phpinfo() and it won't work yet.

Apache error logs: /private/var/log/apache2/error_log


nano /etc/apache2/httpd.conf

Uncomment: LoadModule php5_module libexec/apache2/

create /etc/php.ini or copy it from the default in /etc

Restart apache and php should work now

Install Xdebug by addind the following line in php.ini

zend_extension = ""

Other changes

error_reporting = E_ALL | E_STRICT 
error_log = /path/to/my/php_error.log
short_open_tag = On

Install mcrypt :


##Install Autoconf This may not be necessary for all systems, but it will prevent later steps from failing

sudo chown -R `whoami` /usr/local
brew install autoconf

##Install Pear/Pecl

cd /usr/lib/php
sudo php install-pear-nozlib.phar
sudo pear channel-update
sudo pecl channel-update
sudo pear config-set php_ini /private/etc/php.ini
sudo pecl config-set php_ini /private/etc/php.ini  
sudo pear upgrade-all
sudo pear config-set auto_discover 1

Edit /etc/php.ini and find the line:

;include_path = ".:/php/includes"

and change it to

include_path = ".:/usr/lib/php/pear"

##Install Optional Pear libraries

pear config-set auto_discover 1
pear install PHP_CodeSniffer
pear install
pear channel-discover
pear channel-discover
pear install --alldeps phpmd/PHP_PMD


##PHPUnit PHPUnit with PHPUnit_TicketListener_GitHub For each project, create a phpunit.xml.dist file and test that you can run phpunit from the command line

##Install Phing

pear channel-discover
pear install phing/phing

Create build.xml file for each project and confirm that you can run phing from the command line


Install Jenkins

Install following plugins for jenkins by going to Jenkins and clicking "Manage Jenkins" and then "Manage Plugins"

  • phing plugin
  • Checkstyle
  • CloverPHP
  • HTML Publisher
  • JDepend
  • Plot
  • PMD
  • Violations
  • Github
  • Git

Need to do some mac specific stuff:

##Mongo drivers

brew install autoconf
pecl install mongo

Add to /etc/php.ini :

##Install Karma

brew install phantomjs
npm install karma

##Plugins Install LiveReload from AppStore.

Install browser plugins:

Install AngularJS Batarang Chrome Plugin:

##Sublime Text 2 Install Sublime Text 2.

Install Package Control Plugin:

Install popular plugins using "Preferences > Package Control > Install Package"

  • AngularJS
  • Additional PHP Snippets
  • Goto Documentation (Add a keybinding for it in "Preferences > Key Bindings - User") { "keys": ["super+`"], "command": "goto_documentation" }
  • Theme-Soda
  • Phix Color Scheme
  • Sublimelinter (for contextual linting of JS, CSS and PHP)
  • sublime-closure-linter (for console linting and auto-fix menu command)
  • SideBarEnhancements
  • ColorPick

Edit "Preferences > Settings > user"

"color_scheme": "Packages/Phix Color Scheme/Phix Dark.tmTheme",
"theme": "Soda Dark.sublime-theme",
"tab_size": 3

Install subl command line utility.

ln -s "/Applications/Sublime Text" /bin/subl

Install closure linter

sudo easy_install

Edit SublimeLinter settings:

"sublimelinter_mark_style": "none",
"sublimelinter_gutter_marks": true,
"javascript_linter": "gjslint",
        110,  // line too long
        5 //tab instead of space

Edit sublinme-closure-linter settings:

    "gjslint_path": "/usr/local/bin/gjslint",
    "gjslint_flags": "",
    "fixjsstyle_path": "fixjsstyle",
    "fixjsstyle_flags": "",
        // Ignore errors, regex.
        // "Expected an identifier and instead saw 'undefined' \(a reserved word\)"
        "Illegal tab",
        "Line too long"
    "debug": false,
    "run_on_save": true


##Mysql Download dmg from Install Start mysql from system preferneces panel Set password and socket:

/usr/local/mysql/bin/mysqladmin -u root password 'yourpassword'
mkdir /var/mysql
sh-3.2# sudo ln -s /tmp/mysql.sock /var/mysql/mysql.sock

Make user


Update this in phpmyadmin and in db config file ##Reference

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.