Skip to content

Instantly share code, notes, and snippets.

@stovak
Last active August 29, 2015 14:02
Show Gist options
  • Save stovak/c8c14dd8b2843c6846b5 to your computer and use it in GitHub Desktop.
Save stovak/c8c14dd8b2843c6846b5 to your computer and use it in GitHub Desktop.
Install Hopebrew LAMP stack
#!/bin/bash
export PROFILE_PATH=<<-'PROFILE'
export PATH=$HOME/.composer/vendor/bin:/usr/local/sbin:/usr/local/bin:$PATH
PROFILE
case $1 in
install)
export homebrew=`which brew`
if [[ -z "$homebrew" ]]; then
ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
brew doctor
fi
brew tap homebrew/dupes
brew tap josegonzalez/homebrew-php
########################################################################
# MYSQL
########################################################################
brew install mysql
ln -sfv /usr/local/opt/mysql/*.plist ~/Library/LaunchAgents
mysql.server start
########################################################################
# php
########################################################################
brew install php55 --with-mysql --without-apache --with-fpm --with-mcrypt --with-imap --with-debug --with-homebrew-curl --with-homebrew-libxslt --with-intl --with-tidy --with-bz2
ln -sfv /usr/local/opt/php55/*.plist ~/Library/LaunchAgents
########################################################################
# Nginx
########################################################################
brew install nginx
ln -sfv /usr/local/opt/nginx/*.plist ~/Library/LaunchAgents
#brew install tor
#brew install selinium-server-standalone
brew install caskroom/cask/brew-cask
brew cask install launchrocket
echo $PROFILE_PATH >> ~/.profile
brew install composer
composer selfupdate
;;
start)
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.php55.plist
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.nginx.plist
;;
stop)
launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.php55.plist
launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.nginx.plist
sudo killall php-fpm
;;
restart)
launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.php55.plist
launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.nginx.plist
sudo killall php-fpm
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.php55.plist
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.nginx.plist
;;
nuke)
sudo rm -Rf /usr/local
sudo rm -Rf /opt/brew-cask
sudo rm -Rf /opt/X11
;;
*)
echo $"Usage: $0 {install|nuke|restart}"
exit 1
esac
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment