After my my Mac decided to fuck up after installing Sierra, it gave me a chance to reorganise my shit as I forgot to backup my MAMP Pro installation, so I had to rebuild all 20+ web sites and databases from scratch. Not doing this again as it’s a right pain in the ass.
So after playing around a bit, I’ve moved the htdocs folder and the MySQL databases to Dropbox. I could use iCloud but I’m not installing that shit on my Workstation PC at home.
Before we go to Terminal, make sure MAMP and your MySQL management tool (phpmyadmin/Sequel Pro/Workbench) of choice is closed.
Copying the databases
If you want to use another cloud storage solution, here are the default install path for iCloud:
Just replace the Dropbox path in these examples. So let’s copy the databases folder to Dropbox in a folder called MAMP_db.
cp -r /Library/Application\ Support/appsolute/MAMP\ PRO/db ~/Dropbox/MAMP_db
Rename the default folder to something else
mv /Library/Application\ Support/appsolute/MAMP\ PRO/db /Library/Application\ Support/appsolute/MAMP\ PRO/delete_db
Create a symbolic link to the new folder.
ln -s ~/Dropbox/MAMP_DB /Library/Application\ Support/appsolute/MAMP\ PRO/db
Now start MAMP Pro and wait to see if MySQL loads without errors. I double checked by loading Sequel Pro to see if my databases were there.
If you want to use iCloud instead, use
If that was a success, we can now move the web sites.
Copying the htdocs
Exactly the same commands, just a different folder.
cp -r /Applications/MAMP/htdocs ~/Dropbox/MAMP_htdocs
mv /Applications/MAMP/htdocs /Applications/MAMP/delete_htdocs
ln -s ~/Dropbox/MAMP_htdocs /Applications/MAMP/htdocs
Load MAMP Pro and click localhost and hey presto.
I did this on a fresh installation, and when tried to access localhost I got a Forbidden 403 error. All I did was make a new host and it worked fine.