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
Donation Section: Background
Monero Badge: QR-Code
Monero Badge: Logo Icon Donate with Monero Badge: Logo Text
82uymVXLkvVbB4c4JpTd1tYm1yj1cKPKR2wqmw3XF8YXKTmY7JrTriP4pVwp2EJYBnCFdXhLq4zfFA6ic7VAWCFX5wfQbCC

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.