I'm making a course on Laravel Sanctum: MasteringAuth.com

Setup a new project using Laravel Sail (macOS)

Constantin Druc ยท 13 Jun, 2021

[00:33] Open a new terminal and before you get started make sure you have docker up and running by typing in docker -v and press enter. This will show your current docker version. if you see something like this you're good to go.

[00:50] Now cd into where you usually keep your projects. In my case I have a projects directory right in my home path, then run the following command: curl -s https://laravel.build/example | bash - and here you'll have to type the name of your application. In my case I will set this to tallpad, add in the closing quotes, bang, and press enter.

[00:47] What this will do is it will download some instructions, execute them, and set up Laravel inside a directory named after your application. It may ask you for your operating system password, so type it in and press enter.

[01:02] Navigate to the application directory and start Laravel Sail using the following command: ./vendor/bin/sail up. When you run this command for the first time it will take a few minutes to complete, so be patient; subsequent calls will run much much faster.

[01:28] You may receive, like me, this mysql "ports are not available" error. The easiest way to fix it is to stop your current mysql service. To do that type in brew services stop mysql and press enter. Then rerun the sail command. So I'll go up, and here it is: ./vendor/bin/sail up enter.

[01:57] And now we receive another error saying that it "cannot start service laravel.test ports are not available". This is most likely because you have valet installed so let's also stop valet. valet stop and rerun the sail command.

[02:21] Now we can access our application by going to localhost, and here it is. This is our fresh Laravel installation using Laravel Sail.