Site | Updated | Requires | |||
---|---|---|---|---|---|
2023-11-05 |
|
Laravel is my preferred way to set up a development environment on a local machine, such as macOS.
First, make sure you have completed the installation steps in install-system.sh to install PHP and Composer.
Then, run the following commands to install Valet and trust the local domain:
composer global require laravel/valet
valet install
valet trust
To test that everything is working, run the following command:
ping -c1 localhost.test
This will ping the local domain and should return a 404 page.
There are two ways to set up the database: with DBngin or manually.
I chose to set up the database manually, which is the option that is run by the install.sh
script.
The manually setup
- Install MySQL with Homebrew:
brew install [email protected]
- Start MySQL:
brew services start [email protected]
- Set the MySQL password:
mysql -u root
ALTER USER 'root'@'localhost' IDENTIFIED BY 'root'; FLUSH PRIVILEGES;
Setup based on: https://sqlpad.io/tutorial/mysql-install-mac/
The DBngin setup
- Install DBngin:
brew install --cask dbngin
- Create a MySQL service in DBngin:
- name = mysql
- port = 3306
- socket = /tmp/mysql.sock
- disable log = true
- auto start = true
- Add the following export path to your PATH environment variable:
export PATH=/Users/Shared/DBngin/mysql/5.7.23/bin:$PATH
- Set the MySQL password:
mysql -u root
ALTER USER 'root'@'localhost' IDENTIFIED BY 'root'; FLUSH PRIVILEGES;