How to start Laravel project with "sail up" instead of "./vendor/bin/sail up"

jeromew90

JΓ©rΓ΄me W

Posted on May 31, 2022

How to start Laravel project with "sail up" instead of "./vendor/bin/sail up"

Image description

This tutorial explains how to create a shorcut in your terminal to allow you to start your Laravel project with sail up command instead of ./vendor/bin/sail up using .bashrc in MacOS.

There are only 2 little steps!

Before starting

First, you need to open your terminal. Simple, isn't ? πŸ˜‚

Step 1

In your terminal, run this to open your .bash_profile file :



nano ~/.bash_profile


Enter fullscreen mode Exit fullscreen mode

And paste this :



if [ -r ~/.bashrc ]; then
   source ~/.bashrc
fi


Enter fullscreen mode Exit fullscreen mode

Exit and save the modification.

Step 2

Still in your terminal, run this to open your .bashrc file :



nano ~/.bashrc


Enter fullscreen mode Exit fullscreen mode

And paste this :



alias sail='bash vendor/bin/sail'


Enter fullscreen mode Exit fullscreen mode

Exit and save the modification.

The final word πŸ’¬

Here we go, you can now open any Laravel project using Sail and write the following command to start it :



sail up


Enter fullscreen mode Exit fullscreen mode

Personally, I'm using the Docker's detached mode to free my terminal and be able to use it directly. This consists of adding -d like this :



sail up -d


Enter fullscreen mode Exit fullscreen mode

❓ Notice that I showed 2 steps but depending on your OS environment, you could probably skip the step 1.

Thanks for reading this little tip, feel free to add a comment to share your opinions! πŸ˜€β˜•

πŸ’– πŸ’ͺ πŸ™… 🚩
jeromew90
JΓ©rΓ΄me W

Posted on May 31, 2022

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related