-
Notifications
You must be signed in to change notification settings - Fork 31
MAMP to Valet from scratch
One-time Dependency Setup/Configuration
wget https://getcomposer.org/download/1.1.0/composer.phar && chmod +x composer.phar && sudo mv /usr/local/bin/composer && composer self-update
/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.
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
composer global require laravel/valet
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
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!
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
brew services mariadb start
All
mysql
commands should now be targeting mariadb instead of MAMP's mysql. New credentials are: usernameroot
, password '' (blank). To check this, runwhich mysql
It should now be/usr/local/bin/mysql
mysql -u root -p < ~/mysql-all-databases.sql
valet install
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.
Note: the previous
DB_*
credentials inwp-config.php
will likely need to be updated for the new database. Make sure you update these to reflect the properDB_USER
->root
andDB_PASSWORD
->(none/blank).
One last thing to install...
wp package install aaemnnosttv/wp-cli-valet-command
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
Enjoy.