Open Sublime Text 3 from Terminal in macOS Mojave Linux

Start or Launch Sublime Text 3 from terminal by subl or sublime in Linux command line

Panjeh
2 min readJul 7, 2019

1- Mac OS:

Step 1:

First of all, test this command:

open /Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl

If that worked, you’re good to go step 2. If not, it means you should install sublime and drag the sublime application to the Applications directory.

Step 2:

Then run this command:

sudo ln -s /Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl /usr/local/bin/subl

Step 3:

Checking in terminal by

subl .orsublime ~/Desktop

It will open the current directory or Desktop in Sublime Text! That’s it.

Explanation:

Sublime Text 3 ships with a CLI called subl which is located at (/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl).
We want to create a symlink (symbolic link — or shortcut) of this “subl CLI utility” in the directory /usr/local/bin which is by default in the load path on OS X, and this work allows us to run the subl utility from our Terminal.

If you check your own $PATH by running:

echo $PATH

You will see something like what mine returns:

As you can see the /usr/local/bin path is included by default on OS X.

If you want to name the symlink sublime instead of subl you can do this:

sudo ln -s /Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl /usr/local/bin/sublime

You should never have to type the full word anyway. Typing sub + Tab should auto-complete the full name of the symlink.

For having super and sub tabs refer to the Tip 2 at the end of this article.

2- Linux:

Before any thing, be sure that there is not already a symlink in /usr/bin/since in current versions of ST3 there is no need to any settings.

Just do this in terminal

subl .

But if it does not work, you just need to make a symlink by the following commands.

Depending on what you prefer you should choose one of these:

sudo ln -s /opt/sublime_text/sublime_text /usr/bin/sublime

or

sudo ln -s /opt/sublime_text/sublime_text /usr/bin/subl

Then go to a folder and do:

subl .
or
sublime .

For PhpStorm read this

I would like to introduce two packages for Laravel that I have recently developed: Laravel Pay Pocket, a modern multi-wallet package, and Laravel Failed Jobs, a UI for the Laravel Failed Jobs Table. I hope they may be of help to you.

https://github.com/HPWebdeveloper/laravel-pay-pocket
https://github.com/HPWebdeveloper/laravel-failed-jobs

--

--