Skip to content

Instantly share code, notes, and snippets.

@marchershey
Created June 27, 2025 01:24
Show Gist options
  • Save marchershey/97884a4a804858a38af127ce71fd7f9c to your computer and use it in GitHub Desktop.
Save marchershey/97884a4a804858a38af127ce71fd7f9c to your computer and use it in GitHub Desktop.
The good 'ol fashion way to install Laravel with Sail

Prerequisites

The following needs to be done before you install Laravel.

Bash Aliases

Make sure you've got the bash aliases added. To add them, open ~/.bashrc (nano ~/.bashrc or code ~/.bashrc) and paste them at the top or bottom, anywhere is find. I prefer the top.

Here's the alias to use sail ....

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

Now, to make life a bit easier, I've also got the following just for ease of use. These will allow you to type normal composer ... and php artisan ... commands without having to use sail ... before each command.

alias composer='sh $([ -f sail ] && echo "sail composer" || echo "vendor/bin/sail composer")'
alias artisan='sh $([ -f sail ] && echo "sail artisan" || echo "vendor/bin/sail artisan")'
alias npm='sh $([ -f sail ] && echo "sail npm" || echo "vendor/bin/sail npm")'

So instead of using a command such as sail composer install ... you can just use composer install .... The same goes for sail artisan make:model ModelName, you can just use artisan make:model ModalName. Again, npm is the same as well. Instead of sail npm run dev, you can just type npm run dev.


And the newest alias I have is the following:

alias installlaravel='curl -s "https://laravel.build/app-name?with=mysql" | bash'

That one isn't too important, but if you're installing projects over and over, it makes life a bit easier. Next time you need a new laravel application, just create a new folder and type installlaravel and boom. Laravel is now installed with MySQL.

If you plan on using more than MySQL on every project, you can update the above with whatever services you'd like.

alias installlaravel='curl -s "https://laravel.build/app-name?with=mysql,redis,mailpit" | bash'

Tip

You can change app-name to the name of your app. This will change the name of the folder your laravel application is installed in.

Installing Laravel

Now that's out of the way, let's get down to business.

To install Laravel (without using installlaravel command), you can just paste the following:

curl -s "https://laravel.build/app-name?with=mysql" | bash

Note

Be sure to add whatever services you want.

Example: ...app-name?with=mysql,redis,mailpit

Note

Also, don't forget to change the app-name to the name of your application.

After a few mins (it does take some time), you should have a fully working application.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment