Skip to content

Instantly share code, notes, and snippets.

Revisions

  1. icodejs revised this gist Jun 6, 2012. 1 changed file with 4 additions and 4 deletions.
    8 changes: 4 additions & 4 deletions launch_sublime_from_terminal.markdown
    Original file line number Diff line number Diff line change
    @@ -12,7 +12,7 @@ The official documentation I linked to above recommends creating a ~/bin folder

    So contrary to the Sublime team recommendation, we're not going to create a `bin` folder in your home directory:

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

    This will simply create a [symlink](http://en.wikipedia.org/wiki/Symbolic_link) called `sublime` (remember, we like names that don't suck to type 500 times a day) between the `subl` binary stashed in the Sublime application package, and a folder where your system usually looks for binaries to execute (launch). Think of it as a wormhole of awesome.

    @@ -41,15 +41,15 @@ This will reload your `.profile` with the newly added directory.

    Open a Terminal window and run:

    `sublime filename` (replace "filename" by an actual file name)
    `subl filename` (replace "filename" by an actual file name)

    or

    `sublime foldername` (replace "foldername" by an actual folder name)
    `subl foldername` (replace "foldername" by an actual folder name)

    or even

    `sublime .` (to open the entire current directory)
    `subl .` (to open the entire current directory)

    ## Conclusion

  2. icodejs revised this gist Apr 19, 2012. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions launch_sublime_from_terminal.markdown
    Original file line number Diff line number Diff line change
    @@ -33,9 +33,9 @@ Note: The "(...)" in this example represents other folders that would be listed

    If you had to add `/usr/local/bin` to your PATH, run the following command before continuing:

    `source ~/.bash_profile`
    `source ~/.profile`

    This will reload your `.bash_profile` with the newly added directory.
    This will reload your `.profile` with the newly added directory.

    ## Testing

    @@ -53,7 +53,7 @@ or even

    ## Conclusion

    Now you don't need to get out of Terminal to simply open a file or a folder, you didn't have to add an "alias" or yet another bin directory to your `.bash_profile` which you would have needed with the official instructions given by the Sublime team.
    Now you don't need to get out of Terminal to simply open a file or a folder, you didn't have to add an "alias" or yet another bin directory to your `.profile` which you would have needed with the official instructions given by the Sublime team.

    Have fun, Sublime is a great editor showing a lot of promise.

  3. icodejs revised this gist Apr 19, 2012. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion launch_sublime_from_terminal.markdown
    Original file line number Diff line number Diff line change
    @@ -18,7 +18,7 @@ This will simply create a [symlink](http://en.wikipedia.org/wiki/Symbolic_link)

    Now let's do a check to see if everything will run smoothly. Enter this:

    `open ~/.bash_profile`.
    `open ~/.profile`.

    You should see at the top of the file a line that starts with:
    `export PATH=`
  4. @olivierlacan olivierlacan revised this gist Sep 17, 2011. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion launch_sublime_from_terminal.markdown
    Original file line number Diff line number Diff line change
    @@ -12,7 +12,7 @@ The official documentation I linked to above recommends creating a ~/bin folder

    So contrary to the Sublime team recommendation, we're not going to create a `bin` folder in your home directory:

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

    This will simply create a [symlink](http://en.wikipedia.org/wiki/Symbolic_link) called `sublime` (remember, we like names that don't suck to type 500 times a day) between the `subl` binary stashed in the Sublime application package, and a folder where your system usually looks for binaries to execute (launch). Think of it as a wormhole of awesome.

  5. @olivierlacan olivierlacan revised this gist Sep 5, 2011. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion launch_sublime_from_terminal.markdown
    Original file line number Diff line number Diff line change
    @@ -2,7 +2,7 @@

    Sublime Text 2 ships with a CLI called **subl** (why not "sublime", go figure). This utility is hidden in the following folder (assuming you installed Sublime in `/Applications` like normal folk. If this following line opens Sublime Text for you, then bingo, you're ready.

    `open /Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl`
    `open /Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl`

    You can find more (official) details about subl here: http://www.sublimetext.com/docs/2/osx_command_line.html

  6. @olivierlacan olivierlacan revised this gist Sep 5, 2011. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions launch_sublime_from_terminal.markdown
    Original file line number Diff line number Diff line change
    @@ -1,8 +1,8 @@
    # Launch Sublime Text 2 from the Mac OS X Terminal

    Sublime Text 2 ships with a CLI called **subl** (why not "sublime", go figure). This utility is hidden in the following folder (assuming you installed Sublime in `/Applications` like normal folk:
    Sublime Text 2 ships with a CLI called **subl** (why not "sublime", go figure). This utility is hidden in the following folder (assuming you installed Sublime in `/Applications` like normal folk. If this following line opens Sublime Text for you, then bingo, you're ready.

    `/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl`
    `open /Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl`

    You can find more (official) details about subl here: http://www.sublimetext.com/docs/2/osx_command_line.html

  7. @olivierlacan olivierlacan revised this gist Sep 5, 2011. 1 changed file with 4 additions and 0 deletions.
    4 changes: 4 additions & 0 deletions launch_sublime_from_terminal.markdown
    Original file line number Diff line number Diff line change
    @@ -17,6 +17,7 @@ So contrary to the Sublime team recommendation, we're not going to create a `bin
    This will simply create a [symlink](http://en.wikipedia.org/wiki/Symbolic_link) called `sublime` (remember, we like names that don't suck to type 500 times a day) between the `subl` binary stashed in the Sublime application package, and a folder where your system usually looks for binaries to execute (launch). Think of it as a wormhole of awesome.

    Now let's do a check to see if everything will run smoothly. Enter this:

    `open ~/.bash_profile`.

    You should see at the top of the file a line that starts with:
    @@ -25,18 +26,21 @@ You should see at the top of the file a line that starts with:
    This contains all the directories that will be looked into for executable binaries when you type a command in Terminal. Since we create a symlink to `subl` called `sublime` in the `/usr/local/bin` directory let's check if this directory is listed on that same line.

    If it is, perfect. Let's keep going. If not, simply add it like this and save the file:

    `export PATH=/usr/local/bin:(...)`

    Note: The "(...)" in this example represents other folders that would be listed on the same line and separated by a colon.

    If you had to add `/usr/local/bin` to your PATH, run the following command before continuing:

    `source ~/.bash_profile`

    This will reload your `.bash_profile` with the newly added directory.

    ## Testing

    Open a Terminal window and run:

    `sublime filename` (replace "filename" by an actual file name)

    or
  8. @olivierlacan olivierlacan revised this gist Sep 5, 2011. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion launch_sublime_from_terminal.markdown
    Original file line number Diff line number Diff line change
    @@ -14,7 +14,7 @@ So contrary to the Sublime team recommendation, we're not going to create a `bin

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

    This will simply create a [symlink](http://en.wikipedia.org/wiki/Symbolic_link) between the `subl` binary stashed in the Sublime package, and a folder where your system usually looks for binaries to execute (launch).
    This will simply create a [symlink](http://en.wikipedia.org/wiki/Symbolic_link) called `sublime` (remember, we like names that don't suck to type 500 times a day) between the `subl` binary stashed in the Sublime application package, and a folder where your system usually looks for binaries to execute (launch). Think of it as a wormhole of awesome.

    Now let's do a check to see if everything will run smoothly. Enter this:
    `open ~/.bash_profile`.
  9. @olivierlacan olivierlacan revised this gist Sep 5, 2011. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions launch_sublime_from_terminal.markdown
    Original file line number Diff line number Diff line change
    @@ -37,11 +37,11 @@ This will reload your `.bash_profile` with the newly added directory.
    ## Testing

    Open a Terminal window and run:
    `sublime <filename>` (replace "<filename>" by an actual file name)
    `sublime filename` (replace "filename" by an actual file name)

    or

    `sublime <foldername>` (replace "<foldername>" by an actual folder name)
    `sublime foldername` (replace "foldername" by an actual folder name)

    or even

  10. @olivierlacan olivierlacan revised this gist Sep 5, 2011. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion launch_sublime_from_terminal.markdown
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,6 @@
    # Launch Sublime Text 2 from the Mac OS X Terminal

    Sublime Text 2 ships with a CLI called subl (why not "sublime", go figure). This utility is hidden in the following folder (assuming you installed Sublime in `/Applications` like normal folk:
    Sublime Text 2 ships with a CLI called **subl** (why not "sublime", go figure). This utility is hidden in the following folder (assuming you installed Sublime in `/Applications` like normal folk:

    `/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl`

  11. @olivierlacan olivierlacan created this gist Sep 5, 2011.
    56 changes: 56 additions & 0 deletions launch_sublime_from_terminal.markdown
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,56 @@
    # Launch Sublime Text 2 from the Mac OS X Terminal

    Sublime Text 2 ships with a CLI called subl (why not "sublime", go figure). This utility is hidden in the following folder (assuming you installed Sublime in `/Applications` like normal folk:

    `/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl`

    You can find more (official) details about subl here: http://www.sublimetext.com/docs/2/osx_command_line.html

    ## Installation

    The official documentation I linked to above recommends creating a ~/bin folder (in your home directory). That's weird, I don't recall ever being asked to do that on OS X since most people install binaries within `/usr/local/bin` which – if you're a developer – is likely to already have tons of other binaries.

    So contrary to the Sublime team recommendation, we're not going to create a `bin` folder in your home directory:

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

    This will simply create a [symlink](http://en.wikipedia.org/wiki/Symbolic_link) between the `subl` binary stashed in the Sublime package, and a folder where your system usually looks for binaries to execute (launch).

    Now let's do a check to see if everything will run smoothly. Enter this:
    `open ~/.bash_profile`.

    You should see at the top of the file a line that starts with:
    `export PATH=`

    This contains all the directories that will be looked into for executable binaries when you type a command in Terminal. Since we create a symlink to `subl` called `sublime` in the `/usr/local/bin` directory let's check if this directory is listed on that same line.

    If it is, perfect. Let's keep going. If not, simply add it like this and save the file:
    `export PATH=/usr/local/bin:(...)`

    Note: The "(...)" in this example represents other folders that would be listed on the same line and separated by a colon.

    If you had to add `/usr/local/bin` to your PATH, run the following command before continuing:
    `source ~/.bash_profile`

    This will reload your `.bash_profile` with the newly added directory.

    ## Testing

    Open a Terminal window and run:
    `sublime <filename>` (replace "<filename>" by an actual file name)

    or

    `sublime <foldername>` (replace "<foldername>" by an actual folder name)

    or even

    `sublime .` (to open the entire current directory)

    ## Conclusion

    Now you don't need to get out of Terminal to simply open a file or a folder, you didn't have to add an "alias" or yet another bin directory to your `.bash_profile` which you would have needed with the official instructions given by the Sublime team.

    Have fun, Sublime is a great editor showing a lot of promise.