Skip to content

Instantly share code, notes, and snippets.

@montrealist
Last active December 10, 2020 16:44
Show Gist options
  • Save montrealist/d5d6304a1ee5fc818ec8ee8088f4c1f9 to your computer and use it in GitHub Desktop.
Save montrealist/d5d6304a1ee5fc818ec8ee8088f4c1f9 to your computer and use it in GitHub Desktop.
Steps for creating a local MAMP site on Mac

Updated MAMP and it's no longer working?

/Applications/MAMP/conf/apache/httpd.conf needs this line to be uncommented:

# Virtual hosts
#Include /Applications/MAMP/conf/apache/extra/httpd-vhosts.conf

Also MAMP might replace this file with a default version, so make sure to back it up.

Main Activities

  • open /etc/hosts:
sudo vim /etc/hosts
  • add domain:
127.0.0.1    local.[REPLACE.ME]
  • Configure the host:
vim /Applications/MAMP/conf/apache/extra/httpd-vhosts.conf
<VirtualHost *:80>
DocumentRoot "/Applications/MAMP/htdocs/local.[REPLACE.ME]"
ServerName local.[REPLACE.ME]
</VirtualHost>
  • Create directory for the site:
mkdir /Applications/MAMP/htdocs/local.[REPLACE.ME] && cd /Applications/MAMP/htdocs/local.[REPLACE.ME]
wp core download
  • Start MAMP, click on "start servers"

  • Open PHPMyAdmin: http://localhost/phpMyAdmin/?lang=en

  • Create DB (name as domain with underscores instead of dots: REPLACE_ME), use UTF8_BIN encoding.

  • Rename wp-config-sample.php to wp-config.php:

mv wp-config-sample.php wp-config.php
  • Insert DB name from above into wp-config.php (u/p: root/root)

  • Insert into .htaccess remove upload max filesize limits:

touch .htaccess && echo 'php_value upload_max_filesize 5120M
php_value post_max_size 5120M
php_value memory_limit 512M
php_value max_execution_time 3000
php_value max_input_time 3000' > .htaccess
  • Enable debugging in wp-config.php:
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', false );
  • Install WP
wp core install --url=local.[REPLACE.ME] --title=local.[REPLACE.ME] --admin_user=foobar-admin --admin_password=foobar-admin [email protected]
  • Install all-in-one-wp-migration plugin:
wp plugin install all-in-one-wp-migration --activate && wp plugin uninstall akismet
wp rewrite flush
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment