4

Is there a way to open files using Sublime from OSX terminal:

Like this in Linux, but the equivalent in OSX:

gedit file.txt
Amr M. AbdulRahman
  • 1,820
  • 3
  • 14
  • 22
  • Possible duplicate of [Sublime Text 3 and Terminal prompt for OS X Mavericks?](http://stackoverflow.com/questions/19543643/sublime-text-3-and-terminal-prompt-for-os-x-mavericks) – idleberg Jul 25 '16 at 10:16

3 Answers3

8

You can also create a symbolic link to Sublime Text to launch it from the terminal with a simple command like "sublime path":

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

You should change the installation path accordingly. It's also possible to use any other alias than sublime, but it's best to be explicit.

2

You can use the general command for opening files with an application, like:

open -a Sublime.app file.txt
Renzo
  • 26,848
  • 5
  • 49
  • 61
0

This should work:

open /Applications/Sublime\ Text.app

If you want to keep sublime as an alias for future use you can add it to your .bash_profile:

echo "alias subl=\"open /Applications/Sublime\ Text.app\"" >> ~/.bash_profile
source ~/.bash_profile
sublime
NM Pennypacker
  • 6,704
  • 11
  • 36
  • 38