I'm tryng to use Sublime Text from the terminal, for example by typing subl
.
I'm following the steps from Sublime Text's website:
Setup
The first task is to make a symlink to subl. Assuming you've placed Sublime Text 2 in the Applications folder, and that you have a ~/bin directory in your path, you can run:
ln -s "/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl" ~/bin/subl
I keep getting permission denied : ~/bin/subl: Permission Denied
I have been searching around for a similar problem but can't find one that's applicable. Can someone point me to the right direction?
Sublime Text includes a command-line helper called subl . Using the command-line helper, you can open files and folders and perform other actions from the command line. Before using subl , make sure it is on your PATH . To put subl on your PATH , you may need to add directories to PATH or use symbolic links.
Documentation Command Line Interface. Version: Sublime Text includes a command line tool, subl , to work with files on the command line. This can be used to open files and projects in Sublime Text, as well working as an EDITOR for unix tools, such as git and subversion.
I am assuming that you don't have the bin directory. You can do the following:
cd mkdir bin sudo ln -s "/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl" ~/bin/subl
ln -s
will create a alias of the subl file in your bin directory and you will be able to run the command.
If this still doesn't work you will have to edit your .bash_profile. You can do it by following commands: (NOTE: For this to work you need to have done the above steps already.)
Open your .bash_profile:
cd // this will get you back to home directory vim .bash_profile // this will open your .bash_profile file
Edit .bash_profile: press I to get into "insert" mode and add following:
export PATH=$PATH:~/bin
Save and exit. Press Esc to get into command mode:
:wq // saves and close file exit // exits terminal
Reopen the terminal:
subl --help
That should bring up the help for Sublime Text.
My personal preference for the path to the third-party application-specific symbolic links (e.g. subl
, brew
, github
, mate
, etc) is:
/usr/local/bin
Why not /usr/bin/
?
/usr/bin
is a "sacred" place. It is generally recommended to store static binaries that are maintained by package management systems. subl
is not this case.
subl
is not stable enough to be stored in /usr/bin
with other basic BSD binaries (e.g. find
, man
, make
, etc). You must modify/delete subl
symbolic link manually if (a) the developers of Sublime Text Editor decide to change its app name in the future releases (as BBEdit Lite was changed to TextWrangler after version 6.1), or (b) you may simply wish to uninstall Sublime Text Editor.
Therefore, I suggest you execute the following line, assuming /usr/local/bin/
exists:
ln -s "/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl" /usr/local/bin/subl
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With