make sure you have already install Sublime Text 3 on you Mac
clone it and put the file subl.sh
to /usr/local/bin/
run sudo chmod +x /usr/local/bin/subl
after all that you can use like this
$ cd your/code/directory
$ subl .
or
$ subl file.txt
enjoy the magic
contact me if you have any question
china:xiaoamani@qq.com
gmail:xiaoyulevin@gmail.com