OSX zsh - bash: Command not found in MacOS

- Andrés Cruz

En español

OSX zsh - bash: Command not found in MacOS

The error of:

command not found

It can happen in multiple numbers of commands depending on the technology you are using. It can happen with programs like Laravel, flutter, composer, homebrew, etc. and the solution is to add the path to the program to the system PATH.

To solve the previous problem, you must set the command in the system PATH; Let's look at some examples.

For example, to add Flutter we have:

export PATH=$PATH:/Users/andrescruz/development/flutter/bin

To add composer:

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

This moves composer.phar to /usr/local/bin/ and is renamed composer (which is still an executable, not a folder).

export PATH=$PATH:/Users/andrescruz/development/flutter/bin

In the case of Homebrew:

export PATH=$PATH:/opt/homebrew/bin

Or Laravel:

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

Place the PATH on multiple lines

Of course, when you are preparing your environment, you will probably need to add several programs to the PATH; To do this, simply separate the programs with a colon (:) or on separate lines; for example:

export PATH=$PATH:/Users/andrescruz/development/flutter/bin:/opt/homebrew/bin

export
PATH=$PATH:/Users/andrescruz/development/flutter/bin:/opt/homebrew/bin
export PATH="$HOME/.composer/vendor/bin:$PATH"

Modify the PATH with zshrc

To modify the zshrc file and with this the PATH, we use nano as an editor:

$ nano ~/.zshrc

And we add the PATH:

$ export PATH=$PATH:/<PathFlutter>/flutter/bin

In this guide it would be:

export PATH=$PATH:/Users/andrescruz/development/flutter/bin

Ctrl + O to save and Ctrl + X to exit.

And with this, we present multiple examples to establish commands in MacOS.

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.

!Courses from!

10$

On Udemy

There are 2d 10:45!


Udemy

!Courses from!

4$

In Academy

View courses

!Books from!

1$

See the books
¡Become an affiliate on Gumroad!