To fix -bash: symfony: command not found error you need to install the Symfony CLI by running

wget https://get.symfony.com/cli/installer -O - | bash

Works on Linux and MacOS. For more installation methods you can read more below.

How to fix symfony: command not found in Linux? 

You'll need to install Symfony CLI on your Linux machine, here are the installation methods available:

# Wget
wget https://get.symfony.com/cli/installer -O - | bash

# Curl
curl -sS https://get.symfony.com/cli/installer | bash

# Debian/Ubuntu (APT based)
curl -1sLf 'https://dl.cloudsmith.io/public/symfony/stable/setup.deb.sh' | sudo -E bash
sudo apt install symfony-cli

# Fedora/CentOS/Suse/RedHat (YUM based)
curl -1sLf 'https://dl.cloudsmith.io/public/symfony/stable/setup.rpm.sh' | sudo -E bash
sudo dnf install symfony-cli

How to fix symfony: command not found in Windows? 

You'll need to install Symfony CLI on your Windows machine, here are the installation methods available:

scoop install symfony-cli

How to fix symfony: command not found on Mac? 

You'll need to install Symfony CLI on your Mac machine, here are the installation methods available:

# Wget
wget https://get.symfony.com/cli/installer -O - | bash

# Curl 
curl -sS https://get.symfony.com/cli/installer | bash

# Homebrew
brew install symfony-cli/tap/symfony-cli

How to fix E: Unable to locate package symfony-cli

You need to update your repositories by running 

# Ubuntu/Debian (APT based)
sudo apt update

# CentOS/Redhat (YUM based)
yum makecache

How to fix Bash usr/local/bin symfony No such file or directory 

You need to install Symfony CLI by following the guide above.

How to fix symfony is not recognized as an internal or external command

You need to install Symfony CLI on your Windows machine

What is Symfony CLI?

The Symfony CLI (Command Line Interface) is a set of command-line tools provided by the Symfony framework, a popular PHP web application framework. These tools are designed to streamline various development tasks and help developers work more efficiently on Symfony projects.

The Symfony CLI provides commands for a wide range of tasks, including:

  1. Creating Projects: You can use the CLI to create new Symfony projects quickly, setting up the directory structure and essential files.

  2. Generating Code: The CLI can generate boilerplate code for various parts of your application, such as controllers, entities, forms, and more.

  3. Running the Development Server: You can start a built-in development server using the CLI, which makes it easy to test your application during development.

  4. Running Tests: Symfony provides a testing framework, and the CLI enables you to run unit tests, functional tests, and other types of tests for your application.

  5. Database Management: You can manage your application's database schema, run migrations, and interact with the database using the CLI.

  6. Clearing Caches: Symfony uses caching extensively to improve performance. The CLI allows you to clear various caches when needed.

  7. Dependency Management: Symfony relies on Composer for package management. The CLI can help you manage dependencies, install packages, and update your project.

  8. Security Checks: The CLI can check your project for known security vulnerabilities and suggest updates for packages with security issues.

  9. Debugging: The CLI provides tools for debugging and inspecting your application's behavior.

The Symfony CLI is built on top of Symfony's robust and flexible framework, allowing developers to harness the power of Symfony's features through the command line. It significantly simplifies common development tasks and follows Symfony's best practices, making it a valuable tool for Symfony developers.