Launch Sublime Text from Mac Terminal

Often times, I find myself navigating through folder structures via the terminal, and need to browse to that specific location via text editor. Sure, there are options like vi, but I prefer the GUI. In the past, I would have to open up the Sublime Text app (my editor of choice), then go "File" --> "Open", and browse to that location all over again. It's trivial, but it's a hassle at times and wish I could just open it directly from the terminal.

I use this trick all the time. First, copy and paste the below code in to your terminal:

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

This creates a permanent symbolic link between the Sublime Text app in your Applications folder, and the subl command.

Now, as you navigate the command line, you can open your current directory in Sublime Text by typing:

subl .

Voila!