How to fix Laravel command not found for zsh on MacOS

- Andrés Cruz

En español
How to fix Laravel command not found for zsh on MacOS

The terminal commands are great in the Laravel ecosystem since they allow you to create the project to be able to manage different parts of it; when we install the Laravel installer globally with composer, many times it is not recognized as a valid command until we add it to the path; let's see how to do it.

To allow the use of commands beginning with 'laravel', you will need to edit your .zshrc file; usually this happens when executing the laravel installer:

laravel new proyectolaravel

This file should be in your home folder.

First, check if the file exists:

open -e ~/.zshrc

Next, add the following code to the bottom of your .zshrc file:

PATH="$HOME/.composer/vendor/bin:$PATH"

Save the file. The changes will now be implemented in any new terminal session. Please stop the current session or run the code below, and then it will work for the current session as well:

source ~/.zshrc
Andrés Cruz

Develop with Laravel, Django, Flask, CodeIgniter, HTML5, CSS3, MySQL, JavaScript, Vue, Android, iOS, Flutter

Andrés Cruz In Udemy

I agree to receive announcements of interest about this Blog.