Magento Local Install for Mac

This document only applies to Mac computers, Valet is incompatible with Windows and this document will not complete

  1. 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

     

  2. 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

     

  3. Install Composer by following the instructions here:https://getcomposer.org/download/

  4. sudo mv composer.phar /usr/local/bin/composer

  5. verify composer works and installed properly by running composer

  6. Add Composer binaries to your path

  7. Install Laravel Valet Composer Package

    If on an M1 mac

  8. Run Laravel Valet installer, this will throw an error, but that’s normal

  9. 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

  1. Click the Plus in the Upper right of DBNgin

  2. Choose MySQL in the service dropdown

  3. Give your new server a name, anything is fine

  4. Click Create

Create the Redis Server

  1. Click the Plus in the Upper right of DBNgin

  2. Choose Redis in the service dropdown

  3. Give your new server a name, anything is fine

  4. Click Create

Start your services

  1. 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

Download Sequel Ace

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

Bring Valet Online