Skip to content

Instantly share code, notes, and snippets.

@compwright
Created November 29, 2012 17:55
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save compwright/4170773 to your computer and use it in GitHub Desktop.
Save compwright/4170773 to your computer and use it in GitHub Desktop.
Roll your own MAMP development environment
# This file is a reference script for the blog post
# http://jonathonhill.net/2012-11-29/roll-your-own-mamp-development-environment/,
# and is not intended to be run as a stand-alone install script.
# Some manual steps will be required, please read the blog post before attempting
# to use this script.
# Tutorial:
# http://mac.tutsplus.com/tutorials/server/upgrading-the-native-php-installation-on-os-x-mountain-lion/
# Download and install XQuartz from http://xquartz.macosforge.org/
sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer
ln -s /opt/X11 /usr/X11
# Install and test homebrew
ruby -e "$(curl -fsSkL raw.github.com/mxcl/homebrew/go)"
brew doctor
# Install PHP dependencies
brew install libpng
brew install libjpeg
brew install gd
brew install pcre
brew install libxml2
brew install mcrypt
brew install icu4c
# http://blog.alwayshere.info/2011/11/error-utf8mime2text-has-new-signature.html
# http://geek.daohoangson.com/2012/08/imap-module-for-php-in-mac-os-x.html
wget ftp://ftp.cac.washington.edu/imap/imap-2007f.tar.gz
tar zxvf imap-2007f.tar.gz
cd imap-2007f
make osx EXTRACFLAGS="-arch i386 -arch x86_64 -g -Os -pipe -no-cpp-precomp"
sudo cp c-client/*.h /usr/local/include/
sudo cp c-client/*.c /usr/local/lib
sudo cp c-client/c-client.a /usr/local/lib/libc-client.a
cd ..
# Configure and compile PHP
./configure \
--prefix=/usr \
--mandir=/usr/share/man \
--infodir=/usr/share/info \
--sysconfdir=/private/etc \
--with-apxs2=/usr/sbin/apxs \
--enable-cli \
--with-config-file-path=/etc \
--with-libxml-dir=/usr \
--with-openssl=/usr \
--with-kerberos=/usr \
--with-zlib=/usr \
--enable-bcmath \
--with-bz2=/usr \
--enable-calendar \
--with-curl=/usr \
--enable-dba \
--enable-exif \
--enable-ftp \
--with-gd \
--enable-gd-native-ttf \
--with-icu-dir=/usr/local \
--with-iodbc=/usr \
--with-ldap=/usr \
--with-ldap-sasl=/usr \
--with-libedit=/usr \
--enable-mbstring \
--enable-mbregex \
--with-mysql=mysqlnd \
--with-mysqli=mysqlnd \
--without-pear \
--with-pdo-mysql=mysqlnd \
--with-mysql-sock=/var/mysql/mysql.sock \
--with-readline=/usr \
--enable-shmop \
--with-snmp=/usr \
--enable-soap \
--enable-pcntl \
--enable-sockets \
--enable-sysvmsg \
--enable-sysvsem \
--enable-sysvshm \
--with-tidy \
--enable-wddx \
--with-xmlrpc \
--with-iconv-dir=/usr \
--with-xsl=/usr \
--enable-zip \
--with-imap=/usr/local/imap-2007 \
--with-kerberos \
--with-imap-ssl \
--enable-intl \
--with-pcre-regex \
--with-pgsql=/usr \
--with-pdo-pgsql=/usr \
--with-freetype-dir=/usr/X11 \
--with-jpeg-dir=/usr \
--with-png-dir=/usr/X11
make
sudo make install
# install MySQL, startup script, and control panel
# sudo cp /usr/local/mysql/support-files/my-small.cnf /etc/my.cnf
# add /usr/local/mysql/bin to ~./profile
# Set a root password
# restart mysql
# edit /etc/apache2/httpd.conf
# LoadModule php5_module libexec/apache2/libphp5.so
# AddType application/x-httpd-php .php
# Include /private/etc/apache2/extra/httpd-vhosts.conf
# edit /etc/php.ini
# mysql.default_socket = /tmp/mysql.sock
# mysqli.default_socket = /tmp/mysql.sock
# sudo apachectl restart
# edit /etc/hosts
# edit /private/etc/apache2/extra/httpd-vhosts.conf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment