Menü schliessen
Created: January 31st 2025
Last updated: February 27th 2025
Categories: Common Web Development,  IT Development,  Laravel,  Linux
Author: Tim Fürer

Laravel: How to Bind "sail" as an Alias to "./vendor/bin/sail"

Tags:  guide,  Laravel,  Linux

If you're still typing "vendor/bin/sail" every time you want to interact with Laravel Sail, you should know there's an easier and shorter alternative: binding "sail" as an alias.


Creating The Alias

First, navigate to your shell's configuration file. It may, for example, be at "~/.bashrc" or "~/.zshrc".

Now, append the following entry to the bottom of the file:

# Laravel Sail
alias sail='sh $([ -f sail ] && echo sail || echo vendor/bin/sail)'

Finally, restart your shell and henceforth, every command that once begun with "vendor/bin/sail" shall start with a mere "sail" instead. Enjoy.