Install Homebrew
If you has not homebrew you can install it here: https://brew.sh
command to install homebrew:
Open your terminal command+space:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
If you have installed homebrew you can update it with the next command:
brew update
Install PHP
brew install php
Install composer
If has not composer installed you can go to: https://getcomposer.org/download/
And in terminal paste:
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('sha384', 'composer-setup.php') === 'e0012edf3e80b6978849f5eff0d4b4e4c79ff1609dd1e613307e16318854d24ae64f26d17af3ef0bf7cfb710ca74755a') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php
php -r "unlink('composer-setup.php');"
Move the "composer.phar" file:
mv composer.phar /usr/local/bin/composer
Then run:
composer
You must see this output:
Install the Laravel valet:
composer global require laravel/valet
Move valet to home path:
export PATH=”$PATH:$HOME/.composer/vendor/bin”
Valet install command
valet install
Create a folder to host Laravel projects.
In this example I named it "www" or "Laravel" as you wish:
mkdir wwww
cd www
Install composer Laravel installer:
In terminal add the command:
composer global require laravel/installer
Create a bash profile file:
nano ~/.bash_profile
This command will open nano editor in the terminal.
Write bash profile content
Add the next line as bash profile content:
export PATH=~/.composer/vendor/bin:$PATH
Save and exit (press first control+x and then press y).
Then execute the next command in terminal:
source ~/.bash_profile
Create a new Laravel project
laravel new yourapp
Now you can go to the browser and type the next URL: yourapp.test, you will see:
Install Mysql
Install mysql:
brew install mysql@5.7
Restart mysql service:
brew services start mysql@5.7
Now to add to your setup, maybe you would need a GUI to view database structure and content easier, I strongly recommend SequelPro: https://sequelpro.com/download
To set a connection your credentials are:
- name: anything you wish I used 'development'
- username: root
- password: empty
If you press add to your favorites you would have this connection in your sidebar all the time available with just one click.