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:
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.
Then run this command:
sudo ln -s /Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl /usr/local/bin/subl
Checking in terminal by
subl .orsublime ~/Desktop
It will open the current directory or Desktop in Sublime Text! That’s it.
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:
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
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.
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:
sudo ln -s /opt/sublime_text/sublime_text /usr/bin/sublime
sudo ln -s /opt/sublime_text/sublime_text /usr/bin/subl
Then go to a folder and do: