Skip to content

Instantly share code, notes, and snippets.

@emotality
Last active January 24, 2021 17:56
Show Gist options
  • Save emotality/ee2ed05b404c8244fb1d to your computer and use it in GitHub Desktop.
Save emotality/ee2ed05b404c8244fb1d to your computer and use it in GitHub Desktop.
MAMP for OS X El Capitan 10.11.4 (2016)
#===================================================#
# MAMP (Mac OSX, Apache, MySQL, PHP)
# by Jean-Pierre Fourie <jp@emotality.com>
# Mac OSX 10.11.4 El Capitan
# Apache v2.4.18
# MySQL v5.7.12
# PHP v5.6.19 / v7.0
# [Ruby v2.3.1 / Rails v4.2.6]
#===================================================#
######################################################
## REQUIRED DEPENDANCIES
######################################################
## 01. Homebrew
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
## 02. Ruby
brew install rbenv ruby-build
echo 'if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi' >> ~/.bash_profile
source ~/.bash_profile
rbenv install 2.3.1
rbenv global 2.3.1
ruby -v
## 03. Rails
gem install rails -v 4.2.6
rbenv rehash
rails -v
## 04. Git
git config --global color.ui true
git config --global user.name "YOUR NAME"
git config --global user.email "YOUR@EMAIL.com"
ssh-keygen -t rsa -C "YOUR@EMAIL.com"
######################################################
## APACHE
######################################################
## 01. Make a “Sites” folder at the root level of your account
mkdir /Users/your-username/Sites
## 02. Get your username:
whoami
## 03. Add a “your-username.conf” at:
cd /etc/apache2/users/
## 04. Edit you config file:
sudo nano your-username.conf
# Save and exit: Cntrl + X, Y, Enter
## 05. Paste in the following (replace your username) and save:
<Directory "/Users/your-username/Sites/">
AllowOverride All
Options Indexes MultiViews FollowSymLinks
Require all granted
</Directory>
## 06. Set correct permission for config
sudo chmod 644 your-username.conf
## 07. Open the main httpd.conf and allow some modules:
sudo nano /etc/apache2/httpd.conf
## 08. Uncomment and save the following (Cntrl+W to search):
LoadModule authz_host_module libexec/apache2/mod_authz_host.so
LoadModule authz_core_module libexec/apache2/mod_authz_core.so
LoadModule deflate_module libexec/apache2/mod_deflate.so
LoadModule expires_module libexec/apache2/mod_expires.so
LoadModule userdir_module libexec/apache2/mod_userdir.so
LoadModule rewrite_module libexec/apache2/mod_rewrite.so
LoadModule php5_module libexec/apache2/libphp5.so
Include /private/etc/apache2/extra/httpd-userdir.conf
## 09. Change the root directory:
from:
DocumentRoot "/Library/WebServer/Documents/"
<Directory "/Library/WebServer/Documents/">
to:
DocumentRoot "/Users/your-username/Sites"
<Directory "/Users/your-username/Sites">
## 10. Enable override to "All" inside the <Directory> tag (above):
AllowOverride All
# Save and exit: Cntrl + X, Y, Enter
## 11. Open another Apache config file:
sudo nano /etc/apache2/extra/httpd-userdir.conf
## 12. Uncomment the following then save and exit:
Include /private/etc/apache2/users/*.conf
## 14. Restart the Apache server:
sudo apachectl restart
######################################################
## PHP
######################################################
## 01. Make an index.php file to check your version:
cd /Users/your-username/Sites
echo "<?php phpinfo(); ?>" > index.php
## 02. Load http://localhost to see PHP info
## 03. Update to PHP version 5.6
curl -s http://php-osx.liip.ch/install.sh | bash -s 5.6
## or update to PHP version 7.0
curl -s http://php-osx.liip.ch/install.sh | bash -s 7.0
######################################################
## MYSQL
######################################################
## 01. Download and install MySQL for OSX 10.11
http://cdn.mysql.com//Downloads/MySQL-5.7/mysql-5.7.12-osx10.11-x86_64.dmg
## 02. Copy your temporary password
# An awesome tool that keeps all your clipboards:
# https://itunes.apple.com/us/app/copyclip-clipboard-history/id595191960?mt=12
## 03. Start MySQL: SystemPreference -> MySQL -> Start MySQL Server. Tick Automatically start server on startup.
# Command to start and stop MySQL in Terminal:
sudo launchctl load -F /Library/LaunchDaemons/com.oracle.oss.mysql.mysqld.plist
sudo launchctl unload -F /Library/LaunchDaemons/com.oracle.oss.mysql.mysqld.plist
## 04. Open your shell profile
cd ; nano .bash_profile
## 05. Add MySQL directory in a new line and save
export PATH="/usr/local/mysql/bin:$PATH"
## 06. Reload the shell
source ~/.bash_profile
## 07. Change your MySQL root password
/usr/local/mysql/bin/mysqladmin -u root -p'temppassword' password 'newpassword'
## 08. Fix the 2002 MySQL Socket error
sudo mkdir /var/mysql
sudo ln -s /tmp/mysql.sock /var/mysql/mysql.sock
## 09. Verify your MySQL version if you want to:
/usr/local/mysql/bin/mysql -v -u root -p'newpassword'
## 10. Restart Apache and enjoy your new MAMP server! :)
sudo apachectl restart
######################################################
## THE END
######################################################
@emotality
Copy link
Author

i gotta test it and i keep u posted ..!!

Dude this was back in 2016/17 ... 😅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment