DEV Community

Cover image for Install Laravel Valet
Ariel Mejia
Ariel Mejia

Posted on

Install Laravel Valet

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)"
Enter fullscreen mode Exit fullscreen mode

If you have installed homebrew you can update it with the next command:

brew update
Enter fullscreen mode Exit fullscreen mode

Install PHP

brew install php
Enter fullscreen mode Exit fullscreen mode

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');"
Enter fullscreen mode Exit fullscreen mode

Move the "composer.phar" file:

mv composer.phar /usr/local/bin/composer
Enter fullscreen mode Exit fullscreen mode

Then run:

composer
Enter fullscreen mode Exit fullscreen mode

You must see this output:

Alt Text

Install the Laravel valet:

composer global require laravel/valet
Enter fullscreen mode Exit fullscreen mode

Move valet to home path:

export PATH=”$PATH:$HOME/.composer/vendor/bin”
Enter fullscreen mode Exit fullscreen mode

Valet install command

valet install
Enter fullscreen mode Exit fullscreen mode

Create a folder to host Laravel projects.

In this example I named it "www" or "Laravel" as you wish:

mkdir wwww
cd www
Enter fullscreen mode Exit fullscreen mode

Install composer Laravel installer:

In terminal add the command:

composer global require laravel/installer
Enter fullscreen mode Exit fullscreen mode

Create a bash profile file:

nano ~/.bash_profile
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

Save and exit (press first control+x and then press y).

Then execute the next command in terminal:

source ~/.bash_profile
Enter fullscreen mode Exit fullscreen mode

Create a new Laravel project

laravel new yourapp
Enter fullscreen mode Exit fullscreen mode

Now you can go to the browser and type the next URL: yourapp.test, you will see:

Alt Text

Install Mysql

Install mysql:

brew install mysql@5.7
Enter fullscreen mode Exit fullscreen mode

Restart mysql service:

brew services start mysql@5.7
Enter fullscreen mode Exit fullscreen mode

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.

Top comments (0)