If you’re managing servers with Laravel Forge, the CLI tool makes life easier. But before you can use it, you need to get your system ready — especially on macOS where $PATH setup can get in the way.

Step 1: Add Composer’s global bin to your $PATH

Before installing Forge CLI, make sure your shell knows where to find it. You’ll need to update your shell config file to include Composer’s global binary directory:

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

Where you put that line depends on the shell you use: For zsh (the default on macOS now):

nano ~/.zshrc

Add the export PATH="$HOME/.config/composer/vendor/bin:$PATH" line to the bottom of the file, save, and then run:

source ~/.zshrc

Step 2: Install the Forge CLI

Once your $PATH is set, install the Forge CLI globally using Composer:

composer global require laravel/forge-cli

After installation, you can check that it worked by running:

forge

You should see a list of available commands.

Step 3: Browse the Docs (Optional but Helpful)

The full CLI documentation is available here:
https://forge.laravel.com/docs/cli

Final Thoughts

Once installed, the Forge CLI gives you quick terminal access to your Laravel Forge servers and sites. Just make sure your $PATH is configured right — most issues I’ve run into came from that one step being skipped.

Let me know if I should extend this with examples like deploying a site, restarting services, or linking your Forge account.


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Get Involved & Explore More

an abstract painting with blue and yellow colors

Catch up on what I’ve been writing lately.

Show your gratitude.

Join Dare To Code Email List

Get emails from me on full-stack PHP development by subscribing to the Dare To Code mailing list.