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

1- Mac OS:

Step 1:

First of all, test this command:

If that worked, you’re good to go step 2:

Step 2:

Then run this command:

Step 3:

Checking in terminal by

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:

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:

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

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:

or

Then go to a folder and do:

Written by

Web geek, Self-taught full-stack web developer, Learning Python, Laravel, Vuejs, UX/UI design, Nuclear Physicist PhD

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store