Skip to content

Move away from MAMP to Laravel Valet

These step by step instructions will serve you how to easily transfer everything you need from MAMP to Laravel Valet.

Install Composer

wget https://getcomposer.org/download/1.1.0/composer.phar && chmod +x composer.phar && sudo mv /usr/local/bin/composer && composer self-update

Install Homebrew

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Run brew update just to be sure everything is up to date.

Install WP-CLI

wget https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar && chmod +x wp-cli.phar && sudo mv /usr/local/bin/wp

Install Laravel Valet globally

composer global require laravel/valet

Ensure Composer global bin is in your $PATH

which valet >/dev/null 2>&1 || echo 'export PATH="$HOME/.composer/vendor/bin:$PATH"' >> "$HOME/.bash_profile"

Restart your terminal or source "$HOME/.bash_profile"

This also assumes you are using Terminal/iTerm. If you are using a different shell, eg: zsh, you should know how to update your $PATH accordingly

MAMP

Settings > General Tab:

  • UNCHECK: Start Apache and MySQL on system startup
  • UNCHECK: Start Apache and MySQL when opening MAMP PRO
  • CLICK: Set default MAMP ports
  • Save

MAMP is now running on the default non-standard ports so it won’t be conflicting with our new local services. You can continue to use it to host your databases if you want (instead of Homebrew installed MariaDB or MySQL), but it would require more effort than to switch over.

Export all the things!

Export All Databases from MAMP (optional)

mysqldump -u root -p --all-databases > ~/mysql-all-databases.sql

where -p is -pyourRootPasswordYesThereIsNoSpaceThere (leave as-is for blank password) This will export all databases to a file named mysql-all-databases.sql in your user’s home directory.

Run this to ensure its available brew services

Start up MariaDB

brew services mariadb start

All mysql commands should now be targeting mariadb instead of MAMP’s mysql. New credentials are: username root, password “ (empty). To check this, run which mysql It should now be `/usr/local/bin/mysql`

Import all databases

mysql -u root -p < ~/mysql-all-databases.sql

Run Valet setup

valet install

Congratulations, Valet is ready to go!

Let’s try it out…

From the terminal, navigate to the directory which holds your projects/websites. (Easy way – drag the folder from Finder onto the Terminal icon – a new terminal window will open for that directory)

Run valet park It should say “The ____ directory has been added to your paths”

Now, if your project directory has a folder in called “example”, you can now open your browser and go to http://example.dev and it should magically work!

Until now, the instructions have been totally framework agnostic, as Valet supports many.

Using Valet with WordPress

Note: the previous DB_* credentials in wp-config.php will likely need to be updated for the new database. Make sure you update these to reflect the proper DB_USER -> root and DB_PASSWORD -> “ (empty string).

Creating New Sites in a Single Command

One last thing to install…

wp package install aaemnnosttv/wp-cli-valet-command

Meet your new single command workflow

From that same directory, or any other directory you have “parked”, run:

wp valet new my-project

Congratulations, you now have a fresh new install of WordPress in the my-project directory, available RIGHT NOW in your browser at https://my-project.dev