Rarely do I need to set this up, so I don’t always remember the exact steps for OS X. Here they are.
Open up whatever shell environment run commands script (~/.bashrc or ~/.zshrc) and add in this towards the top, or adding to one that’s already there.
Save and exit, then create a symbolic link for Sublime Text and run source the script above:
Now you should be able to run subl <filename> or subl <foldername> from the CLI.