If the ln
works but subl
doesn’t, then the ~/bin
folder isn’t in your PATH
, so the shell doesn’t know to look there.
To fix that you need to modify your PATH
environment variable to include the bin
folder in your home directory so that it knows to look there. You can verify this by using the command which subl
in the shell; if it says nothing at all, then it can’t find subl
, otherwise it will tell you where it’s found.
Assuming your shell is bash
(it is on my MacBook but I prefer bash so I don’t know if there are any alternatives), you can create or edit the file .bashrc
in your home directory (note the leading dot) and then add the following line:
export PATH=$PATH:$HOME/bin
This modifies the path by changing it’s value to the existing path plus a new entry for a folder named bin
in your home directory.
The .bashrc
file is only loaded and executed when a new interactive shell is opened, so for this to take effect you need to open a brand new terminal window; it won’t have any effect in existing terminals. As a shortcut for testing purposes, entering the command bash
will start a new shell inside of an existing shell.
If your shell isn’t bash
, then there is some similar series of steps that you would need to take, but exactly what they are depends on the shell you’re using.