Question or issue on macOS:
Sublime Text 3 ships with a CLI called subl which is loca t ed at (/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl). We want to create a symlink (symbolic link — or shortcut) of this. Glue: Terminal Integration for Sublime Text 3 August 1, 2016 Mengatasi masalah Jekyll-Paginate gem July 16, 2016 Menampilkan Icon File pada Sidebar Sublime Text 3 February 22, 2016.
In Terminal when I use .subl
It returns -bash: .subl: command not found
Anyone know how to open Sublime Text 3 from the command line in macOS?
How to solve this problem?
Solution no. 1:
I finally got this to work on my OSX box. I used these steps to get it to work:
Test
subl
from your ST installation:First, navigate to a small folder in Terminal that you want ST to open and enter the following command:
NOTE: You may need to replace
Sublime Text.app
in the command above toSublime Text 3.app
orSublime Text 2.app
depending upon where the application is stored in yourApplications
directory. The.
at the end of the above command opens the current working directory you are located in (again make sure you’re in a directory that only contains a few files!).If you DO NOT get Sublime Text opening your current working directory then the next set of steps will NOT work. If nothing happens or you get an error from Terminal it will be because it couldn’t find the Sublime Text application. This would mean that you would have to check what you’ve typed (spelling, etc.) OR that Sublime Text isn’t installed!
Check “.bash_profile”:
Now it’s time to create your symbolic link in your
PATH
folder, BUT, before we do, let’s check your profile file by usingnano ~/.bash_profile
. These are the following lines that pertain to havingsubl
work on the command line for Sublime Text:The first line sets the location where you want Terminal to look for binaries on your machine, I’m going to store my symbolic link in the
/usr/local/bin
directory – I guess you could store it anywhere provided you’ve notified Terminal where to look for binaries.The second line is OPTIONAL and just sets Sublime Text as the default editor. The flag
-w
has been added and you can find out more about flags by going to the Sublime Text docs: ST3 subl or ST2 sublIf you do make any edits to this file once you have closed it, you need to run the command:
to compile your newly applied edits. If you see any errors after sourcing your file get them fixed before moving to the final step.
Create a symbolic link to Sublime Text:
Now in your chosen path (I used
/usr/local/bin
) you now enter the following command:The
/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl
being EXACTLY the same location as what you entered and verified as working in STEP 1 above. The/usr/local/bin/subl
being the location of where you want the symbolic link to be located – needs to be one of yourPATH
locations from STEP 2 above.Now when you navigate to a folder or file that you want to open in Sublime Text you now just enter
subl
followed by the name of the file or.
to open the current working directory.
Solution no. 2:
For MAC 10.8+:
worked.
Solution no. 3:
Assuming:
- You have already installed Homebrew.
- /usr/local/bin is in your $PATH.
- You are on Yosemite or El Capitain.
MacOS Sierra 10.12.5 works as well confirmed by David Rawson and MacOS Sierra 10.12.6 confirmed by Alexander K.
Run the following script in Terminal to create the specific symlink.
Then:
Hit Return and it should instantly open Sublime Text.
Solution no. 4:
This worked for me (I’m using OS X Mavericks)
First, create a symbolic link:
Now you can open sublime with
Solution no. 5:
I’m using oh-my-zsh on Mac OSX Mavericks and the symbol link didn’t work for me, so I added an alias in my .zshrc file instead:
Open a new terminal and you should be good to go, and type subl
.
Solution no. 6:
The one I will use is very simple.
this opens up the sublime text right away. You can specify the file to open as an optional parameter, e.g. to open “myfile.txt” in the current directory.
Solution no. 7:
There is a easy way to do this. It only takes a couple steps and you don’t need to use the command line too much. If you new to the command line this is the way to do it.
Step 1 : Finding the bin file to put the subl executable file in
- Open up the terminal
- type in
cd ..
———————this should go back a directory - type in
ls
————————to see a list of files in the directory - type in
cd ..
———————until you get a folder that contains usr - type in
open usr
—————this should open the finder and you should see some folders - open up the bin folder ——-this is where you will copy your sublime executable file.
Step 2: Finding the executable file
- open up the finder
- Under file open up a new finder window (CMD + N)
- Navigate to applications folder
- find Sublime Text and right click so you get a pulldown menu
- Click on Show Package Content
- Open up Content/SharedSupport/bin
- Copy the subl file
- Paste it in the bin folder in the usr folder we found earlier
- In the terminal type in
subl
————–this should open Sublime Text
Make sure that it gets copied and it’s not a shortcut. If you do have a problem, view the usr/bin folder as icons and paste the subl in a empty area in the folder. It should not have a shortcut arrow in the icon image.
Solution no. 8:
Try this.
Solution no. 9:
The Symlink command from the Sublime Text 3 documentation won’t work as there is no ~/bin/
directory in Home location on Mac OS X El Capitan or later.
So, we’ll need to place the symlink on the /usr/local/bin
as this path would be in our $PATH
variable in most cases.
So, the following command should do the trick:
Once you create the symlink correctly, you would be able to run the Sublime Text 3 like this: subl .
(. means the current directory)
Solution no. 10:
You can create a new alias in Terminal:
Copy this line and paste it into the editor:
Hit control + x, then y, then enter to save and close it.
Close all Terminal windows and open it up again.
That’s it, you can now use subl filename
or subl .
Hope this helps!
BrowseBring a real terminal to Sublime Text
Installs
- Total107K
- Win54K
- Mac25K
- Linux28K
Apr 25 | Apr 24 | Apr 23 | Apr 22 | Apr 21 | Apr 20 | Apr 19 | Apr 18 | Apr 17 | Apr 16 | Apr 15 | Apr 14 | Apr 13 | Apr 12 | Apr 11 | Apr 10 | Apr 9 | Apr 8 | Apr 7 | Apr 6 | Apr 5 | Apr 4 | Apr 3 | Apr 2 | Apr 1 | Mar 31 | Mar 30 | Mar 29 | Mar 28 | Mar 27 | Mar 26 | Mar 25 | Mar 24 | Mar 23 | Mar 22 | Mar 21 | Mar 20 | Mar 19 | Mar 18 | Mar 17 | Mar 16 | Mar 15 | Mar 14 | Mar 13 | Mar 12 | Mar 11 | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Windows | 48 | 80 | 121 | 108 | 109 | 110 | 106 | 98 | 89 | 117 | 107 | 117 | 102 | 109 | 88 | 97 | 95 | 94 | 125 | 91 | 86 | 74 | 83 | 115 | 80 | 110 | 107 | 96 | 85 | 106 | 108 | 107 | 109 | 127 | 99 | 91 | 89 | 113 | 95 | 109 | 89 | 85 | 85 | 98 | 103 | 110 |
Mac | 20 | 26 | 29 | 31 | 44 | 36 | 43 | 26 | 29 | 35 | 47 | 40 | 45 | 33 | 30 | 35 | 46 | 30 | 32 | 44 | 32 | 15 | 27 | 35 | 43 | 37 | 26 | 37 | 19 | 18 | 26 | 47 | 43 | 41 | 36 | 21 | 16 | 30 | 29 | 30 | 23 | 39 | 27 | 23 | 34 | 30 |
Linux | 36 | 35 | 43 | 48 | 47 | 48 | 39 | 40 | 41 | 40 | 45 | 42 | 37 | 45 | 21 | 38 | 43 | 51 | 38 | 29 | 37 | 50 | 51 | 33 | 47 | 26 | 52 | 61 | 37 | 33 | 38 | 54 | 47 | 42 | 42 | 42 | 52 | 45 | 44 | 41 | 50 | 48 | 30 | 38 | 33 | 38 |
Readme
- Source
- raw.githubusercontent.com
The first cross platform terminal for Sublime Text.
Unix shell | Cmd.exe |
---|---|
Terminal in panel | Support showing images |
This package is heavily inspired by TerminalView. Compare with TerminalView, this has
- Windows support
- continuous history
- easily customizable themes (see Terminus Utilities)
- unicode support
- 256 colors support
- better xterm support
- terminal panel
- imgcat support (PS: it also works on Linux / WSL)
Installation
Package Control.
Getting started
run
Terminus: Open Default Shell in Tab
OdatNurd has made several videos on Terminus. See, for examples,
- https://www.youtube.com/watch?v=etIJMVIvVgg (most up to date)
Shell configurations
Terminus comes with several shell configurations. The settings file should be quite self explanatory.
User Key Bindings
You may find these key bindings useful. To edit, run Preferences: Terminus Key Bindings
.Check the details for the arguments of terminus_open
below.
- toggle terminal panel
- open a terminal view at current file directory
or by passing a custom cmd
, say ipython
- open terminal in a split view by using Origami's
carry_file_to_pane
- ctrl-w to close terminal
Following keybinding can be considered if one wants to use ctrl+w
to close terminals.
User Commands in Palette
- run
Preferences: Terminus Command Palette
. Check the details for the arguments ofterminus_open
below
or by passing custom cmd
, say ipython
- open terminal in a split tab by using Origami's
carry_file_to_pane
Terminus Build System
It is possible to use Terminus
as a build system. The target terminus_exec
is a drop in replacement of the default target exec
. It takes exact same arguments as terminus_open
except that their default values are set differently.
terminus_cancel_build
is used to cancel the build when user runs cancel_build
triggered by ctrl+c (macOS) or ctrl+break (Windows / Linux).
The following is an example of build system define in project settings that run a python script
The same Hello World example could be specified via a .sublime-build
file.
Instead of cmd
, user could also specify shell_cmd
. In macOS and linux, a bash shell will be invoked; and in Windows, cmd.exe will be invoked.
Alt-Left/Right to move between words (Unix)
Bash: add the following in
.bash_profile
or.bashrc
Zsh: add the following in
.zshrc
Some programs, such as julia, do not recognize the standard keycodes for alt+left
and alt+right
. You couldbind them to alt+b
and alt+f
respectively“json[ { 'keys”: [“alt+left”], “command”: “terminus_keypress”, “args”: {“key”: “b”, “alt”: true}, “context”: [{“key”: “terminus_view”}] }, { “keys”: [“alt+right”], “command”: “terminus_keypress”, “args”: {“key”: “f”, “alt”: true}, “context”: [{“key”: “terminus_view”}] }]
The fields cmd
and cwd
understand Sublime Text build system variables.
the setting
view.settings().get('terminus_view.tag')
can be used to identify the terminal andkeybind can be binded with specific tagged terminal
- text can be sent to the terminal with
If tag
is not provided or is None
, the text will be sent to the first terminal found in the current window.
FAQ
Memory issue
It is known that Terminus sometimes consumes a lot of memory after extensive use. It is because Sublime Text keeps an infinite undo stack. There is virtually no fix unless upstream provides an API to work with the undo stack. Meanwhile, users could execute Terminus: Reset
to release the memory.
Color issue when maximizing and minimizing terminal
It is known that the color of the scrollback history will be lost when a terminal is maximized or minimized from or to the panel. There is no fix for this issue.
Terminal panel background issue
If you are using DA UI and your terminal panel has weired background color,try playing with the setting panel_background_color
in DA UI: ThemeSettings
.
Cmd.exe rendering issue in panel
Due to a upstream bug (may winpty or cmd.exe?), there may be arbitrary empty lines inserted between prompts if the panel is too short. It seems that cmder and powershell are not affected by this bug.
Sublime Text 3 Free Download Windows 10
Acknowledgments
Sublime Text 3 Mac
This package won't be possible without pyte, pywinpty and ptyprocess.
Comments are closed.