Opening Sublime Text via Terminal in mac

i don’t like running gulp commands from terminal and go to the docked sublime icon all the way to open sublime and then adding up a folder to work in that particular directory. here’s a short little tutorial which could help you open sublime text from the mighty terminal! 

First step: Finding the subl binary!
if you have installed sublime text the “normal” way, it should be under /Applications/Sublime\ directory, to check it paste the following command in the terminal


this would open up the current directory in sublime text! if this works, you’re good to go to the next step! (if in case it doesn’t work, do check your installation directory!)

Second Step: Exporting Path
add the following code to the terminal!

export PATH=/bin:/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:$PATH

Above code adds up the path(s) where your terminal checks for commands (binary files), We will be creating and storing a link in /usr/local/bin/ directory!

Third Step: Creating Link

ln -s /Applications/Sublime\ /usr/local/bin/subl

This little thing creates a link in “/usr/local/bin” directory, now every time you type subl the terminal checks for the binary in /usr/local/bin/ directory and then it executes sublime text! (TADA!! Eureka moment perhaps?) let’s create a link in the bin directory!

Remember this command (“ln -s /Applications/Sublime\”) is the path of my existing sublime text application directory, the above linking code will only work if the link is right, normally in Mac Os Sierra; its the same as shown!

Now you can run the following command to open sublime text via terminal!

subl .

About the author


A DevSigner, Minimal, building this for next million users, the Creative lad at Gult Design. (

Add comment

By sarabpreet

Latest from Sarabpreet