Skip to content

Instantly share code, notes, and snippets.

@smallevilbeast
Forked from freewayspb/setup-dev.sh
Created July 19, 2018 22:24
Show Gist options
  • Save smallevilbeast/a44a27cd0f83e1cd71f4ed2e4b063a6c to your computer and use it in GitHub Desktop.
Save smallevilbeast/a44a27cd0f83e1cd71f4ed2e4b063a6c to your computer and use it in GitHub Desktop.
Install homebrew, nginx, mysql, php56, and composer on Mac OS X
#!/bin/bash
# install homebrew
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
# install homebrew's official php tap
brew tap josegonzalez/homebrew-php
# install homebrew's official nginx tap
brew tap homebrew/nginx
# install nginx + geoip + upload progress
brew install nginx-full --with-geoip --with-upload-progress-module
# install mysql
brew install mysql
# install php 5.6 + apcu + mcrypt + opcache + solr + xdebug
brew install --with-fpm --with-mysql php56
brew install php56-apcu php56-mcrypt php56-solr php56-xdebug
# install composer globally
curl -sS https://getcomposer.org/installer | php
mv composer.phar /usr/local/bin/composer
# set up mysql to run as user account
unset TMPDIR
mysql_install_db --verbose --user=`whoami` --basedir="$(brew --prefix mysql)" --datadir=/usr/local/var/mysql --tmpdir=/tmp
# launch mysql on startup
cp `brew --prefix mysql`/homebrew.mxcl.mysql.plist ~/Library/LaunchAgents/
launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
# launch php-fpm on startup
ln -sfv /usr/local/opt/php56/*.plist ~/Library/LaunchAgents
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.php56.plist
# launch nginx at startup as root (in order to listen on privileged port 80):
sudo cp `brew --prefix nginx`/homebrew.mxcl.nginx.plist /Library/LaunchDaemons/
sudo sed -i -e 's/`whoami`/root/g' `brew --prefix nginx`/homebrew.mxcl.nginx.plist
sudo launchctl load -w /Library/LaunchDaemons/homebrew.mxcl.nginx.plist
echo "
POST-INSTALL PROCEDURE:
=======================
1) configure intellij / netbeans / phpstorm / eclipse pdt to connect to xdebug on port 9009
"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment