Install Laravel In New MacOS

I just bought a new MacBook Pro and I need to get started with Laravel. These are the steps to install and run my first project.

1. The easiest way to run lavarel is through a Docker Container instead of having to install all the dependcies llike PHP, composer etc...

2. Start by installing Docker, If you need help installing Docker, you can visit the official page at: docker.com

3. Download the Docker Desktop from docker.com

4. After downloading completed, run the docker.dmg file

5. After dmg is completed, you will get a popup window to drag and drop docker into the applications directory.
Docker drag and drop installation in MacOS macbook pro

6. You will see a message "Verifying Docker" - This may take a little while, took me 3 minutes

7. You will get a message "Docker" is an app downlaoded from the internet. Are you sure you want to ope it?

8. Click "Open"
Docker is Downloading

9. You will get a promp: Docker Desktop needs priviliaged access.

10. Click OK

11. Enter password and click "Install Helper"
Accept Docker Helper Tool

12. Accept Terms
Accept Docker Terms

13. Open a terminal and send these commands

$ cd ~
$ mkdir laravel
$ cd laravel
$ sudo curl -s "https://laravel.build/example-app" | bash

ERROR: docker is not running - make sure you follow the installation instructions to drag and drop Docker to Apps

ERROR: No Containers Running
Try running a container: Copy and paste this command into your terminal and then come back

$ docker run -d -p 80:80 docker/getting-started

* NOTE: Since this is the first time running the container, it will download the necessary files.
No Docker Container Running Error Message
Go back to the Docker Desktop and you will see getting-started running

Docker is running confirmation

14. Try curl again.

$ sudo curl -s "https://laravel.build/example-app" | bash
$ ls
$ cd example-app

15. Start the laravel appliction using sail

$ ./vendor/bin/sail up

* This make take a while if its the first time sending the command
* Laravel.test Error - I got this error, nonetheless, the container startup OK.

Error: Bind for 0.0.0.0:80 failed: port is already allocated. FIX: Be sure you don't have another container running which is using the same port, if so, but sure to stop it and run the command again:

$ ./vendor/bin/sail up

16. Open your browser and go to: http://localhost
Laravel 9x Main Home Page Splash Screen

Hope that helps

Resource: New Install Visual Code in MacOs with code terminal command

Take it to the next step, follow this great tutorial:

GwunZ5sH2P8