Install Laravel Valet on Mac.

Ariel Mejia Dev
Ariel Mejia Dev
Published in
3 min readAug 18, 2019

Recently I switch my development machine from Windows 10 to Mac, I start to follow the Laravel Documentation Guide to install Valet, everything is very clear, but I have some troubles, So I decide to share some Little tips to make it more easy.

Firstly you need to install Homebrew, it is a package installer, the official site have the command line to install it, it would change by the time so here is the site: link to homebrew, but this is the command to run in your terminal:

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

It requires some xcode command line tools so press enter to download the packages.

Now we are going to update brew

brew update

Then we are going to install PHP

brew install php

Now we are going to install composer:

php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('sha384', 'composer-setup.php') === 'a5c698ffe4b8e849a443b120cd5ba38043260d5c4023dbf93e1558871f1f07f58274fc6f4c93bcfd858c6bd0775cd8d1') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php
php -r "unlink('composer-setup.php');"

To run composer we need to change the composer.phar file

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

Now we can run

composer

And you will see something like

Now we are going to install Laravel Valet

composer global require laravel/valet

Now we need to move Valet to other path

export PATH=”$PATH:$HOME/.composer/vendor/bin”

Install Valet

valet install

Now we need some place to stored the Laravel Projects, so we are going to create a folder named “www” or as you like

mkdir wwww
cd www

Inside the “www” or any name you write for your folder we are going to install Laravel installer with composer

composer global require laravel/installer

Add export path to bash profile file:

nano ~/.bash_profile

Paste the next code into the bash profile file:

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

Now we are able to create new project from composer or from Laravel installer, for example we are going to create a new project called “yourapp”

laravel new yourapp

Now we can type in your browser the URL: yourapp.test, and it should be load with the next screen

If thats the case you almost finish the Valet installation.

If it fail and show “It works” screen you need to stop apache, maybe your machine have a older apache installation, and restart valet

sudo apachectl stop
valet restart

Now if you refresh you would be able to load the Laravel welcome screen.

Now we need a Database so we can install Mysql with brew

brew install mysql@5.7

When the installation finish you need to start the mysql service

brew services start mysql@5.7

Now you will have everything set up, but maybe you will need some GUI software to view data from database, we are going to install sequelPro, you can dowload from here, when it downloads you only need to move the installer to Applications folder and click it to install sequelPro

You will need to config the connection to your Valet enviroment, you can fill the name input with any value you want, the username from Laravel Valet installation is “root” and password is empty, when you fill this values, you only need to press Connect button, and there you have all your Laravel Valet environment for development ready!

--

--

Ariel Mejia Dev
Ariel Mejia Dev

Fullstack Web/Mobile Developer and Laravel enthusiast.