Magento Local Install for Mac
This document only applies to Mac computers, Valet is incompatible with Windows and this document will not complete
Install Homebrew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
If you are on an M1 macbook, you will need to add Homebrew to your path.
echo 'export PATH="/opt/homebrew/bin:$PATH"' >> ~/.zshrc
Install PHP
brew install php@7.4 echo 'export PATH="/usr/local/opt/php@7.4/bin:$PATH"' >> ~/.zshrc source ~/.zshrc
If on an M1 mac
Install Composer by following the instructions here:https://getcomposer.org/download/
sudo mv composer.phar /usr/local/bin/composer
verify composer works and installed properly by running
composer
Add Composer binaries to your path
Install Laravel Valet Composer Package
If on an M1 mac
Run Laravel Valet installer, this will throw an error, but that’s normal
Set the PHP Version of valet to PHP 7.4
Install MySQL and Redis
Go to http://dbngin.com and download the client
Create the MySQL server
Click the Plus in the Upper right of DBNgin
Choose MySQL in the service dropdown
Give your new server a name, anything is fine
Click Create
Create the Redis Server
Click the Plus in the Upper right of DBNgin
Choose Redis in the service dropdown
Give your new server a name, anything is fine
Click Create
Start your services
On each of the new servers you created, click Start.
If you encounter errors, ensure your don’t have running docker containers bound on the same ports
Import the MySQL Database
Download the Database dump
Extract the database dump
Connect to the Local database in Sequel Ace
Run the following commands in the query window by entering the text, and clicking the arrow to the right of “Run Current”. This will bring up a selector and in that selector, choose “Run All Queries”
Select the new database in the dropdown located at the top of the window
Import the SQL file by going to File → Import
Once this is complete, re-enable foreign key checks by running
Modify the URLs in the dump
Modify Nginx and Valet Configurations
Increase the buffers and buffer size in the fastcgi parameters for Nginx
If on an M1 Mac:
Create the valet Nginx configuration directory
Modify the proxy configuration on the valet template
Disable JIT compilation to allow the backend to properly render
If on an M1 Mac
Clone the Magento Repository
Configure Magento to communicate with MySQL and Redis
Open or create app/etc/env.php and paste the following in
**the crypt key below can be found in bitwarden as MySQL Magento Config Crypt Key
Locate the ‘cache’ entry in the array and ensure the backend options point to localhost port 6379
Locate the ‘session’ entry and ensure it’s set to use Redis and localhost port 6379 as well
Locate ‘db’ and ensure it’s set to
Create a .valet-env.php if it doesn’t exist and place the following into it