Skip to content

Leaf CLI ​

Leaf CLI is a command line tool that helps you create, manage and deploy Leaf applications. It's a powerful tool that helps you get started with Leaf quickly and easily. You can do things like creating apps, running your projects, installing dependencies, and more.

Installation ​

This guide will assume that your system meets all the technical requirements.

You can verify that composer is installed by running:

bash
composer --version

To install the Leaf CLI, you can run the following command:

bash
composer global require leafs/cli

This tells Composer to install the Leaf CLI globally on your system. You can verify that the CLI is installed correctly by running:

bash
leaf --version

[Error] command not found: leaf ​

If you get an error saying leaf: command not found, you need to add Composer's global bin directory to your system's PATH. This directory contains every package installed through composer global require. Let's fix this by adding the directory to your PATH.

Depending on your operating system, the composer bin directory will be located in different places. You can find the location by running:

bash
composer global config bin-dir --absolute

If this command does not work, you can try these common locations:

  • Windows: %USERPROFILE%\AppData\Roaming\Composer\vendor\bin
  • macOS: $HOME/.composer/vendor/bin
  • GNU / Linux Distributions: $HOME/.config/composer/vendor/bin or $HOME/.composer/vendor/bin

Adding to PATH ​

Once you have the location, you can add it to your PATH. On Mac and Linux, you can do this by running these in your terminal:

bash
echo 'export PATH="$PATH:$HOME/.composer/vendor/bin"' >> ~/.bashrc
source ~/.bashrc

Or if you're using Zsh:

bash
echo 'export PATH="$PATH:$HOME/.composer/vendor/bin"' >> ~/.zshrc
source ~/.zshrc

Released under the MIT License.