Mac OS X - Local Web Development Environment Setup
My name is Alex Podobas and I’m a member of the UCLA IT Security Office. My IT security work at UCLA involves an ample amount of code review and writing web applications and I use OS X as my primary, day-to-day operating system. Recently, I wiped my computer and decided to use Homebrew as my package and dependency manager to re-install and customize my LAMP-stack (I suppose minus the “L” in that acronym), local environment for web development. The steps below will take you from a fresh install of OS X to having a running web server on your local machine in about an hour.
Notes:
1. *The instructions are attached as a link on the sidebar to your right *
2. Be sure to replace “ampodobas” with your own OS X username. To find out that username, open Terminal (Applications/Utilities/Terminal) and type “whoami”
2.3. I make no guarantees, warranties, representations that executing the instructions below will work as stated. I merely am echoing what worked for me.
open Terminal (Applications/Utilities/Terminal)install Xcode (https://developer.apple.com/xcode/)install Xcode’s Command Line tools for Xcode (Google search for this link)install XQuartz fromhttp://xquartz.macosforge.org/ruby -e “$(curl -fsSLhttps://raw.github.com/mxcl/homebrew/go)”brew doctorbrew tap homebrew/dupesbrew tap josegonzalez/homebrew-phpbrew install php54 —with-pgsqlbrew install php54-xdebugbrew install mcrypt php54-mcryptbrew install gtk+sudo apachectl restartvi ~/.bash_profileexportPATH=“$(brew —prefix josegonzalez/php/php54)/bin:$PATH”sudo vi /etc/apache2/httpd.confAdd after the commented LoadModule directive:⁃ #LoadModule php5_module libexec/apache2/libphp5.so⁃ LoadModule php5_module */usr/local/Cellar/php54/5.4.12/libexec/apache2/libphp5.so⁃ (Note: ensure that the version you actually install from Brew matches the path)⁃ (Note: uncomment the following: Include /private/etc/apache2/extra/httpd-vhosts.conf)sudo apachectl restartbrew install gitbrew install curl-ca-bundlebrew install autoconf automake apple-gcc42 libksba libtool pkg-config libyamlbrew install nodesudo apachectl restartvi ~/.bash_profile⁃ exportPATH=“/usr/local/mysql/bin:$PATH”brew install mysqlmkdir -p ~/Library/LaunchAgentsln -sfv /usr/local/opt/mysql/*.plist ~/Library/LaunchAgentslaunchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plistmysql_secure_installationmysql.server startmkdir /Users/ampodobas/Sitessudo vi /etc/apache2/httpd.confEnsure DocumentRoot is set to DocumentRoot “/Library/WebServer/Documents/”Change “AllowOverride None” to “AllowOverride All”Add the following (this web posting doesn’t really allow spaces and breaks but please use standard conventions when adding spaces) and then run “sudo apachectl restart” once you’ve added and saved the vi edit
NameVirtualHost *:80<Directory “/Users/name/Sites”> Options Indexes FollowSymLinks MultiViews AllowOverride All Order allow,deny Allow from all