- September 2015
- August 2015
- May 2015
- December 2014
- November 2014
- March 2014
- January 2014
- December 2013
- November 2013
- October 2013
- August 2013
- April 2013
- March 2013
- February 2013
- January 2013
- December 2012
- October 2012
- September 2012
- August 2012
- January 2012
- July 2011
- June 2011
- March 2011
- November 2010
- October 2010
- September 2010
- August 2010
- July 2010
- June 2010
- May 2010
- April 2010
- March 2010
- February 2010
- January 2010
- December 2009
- November 2009
- October 2009
Today I decided I wanted to be able to run Sublime Text from my Terminal. Did a bit of Googling and pieced together the steps here.
Setting up “bin” in your home directory
1. Make a folder called “Bin” in your home directory if it doesn’t already exist. If you’re not sure how or what I mean, open a Terminal and type:
You’re now in your home directory! Now we’ll create a directory called “bin”:
Link up your Sublime application file to a shortcut
2. Once that’s created run this command to create a symlink to your Sublime Text installation (note this is for Sublime Text 2):
ln -s "/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl" ~/bin/subl
Check if it works!
3. Restart your Terminal and it may already work. Type in:
Do you see help text that starts with “Sublime Text 2 Build…”? If so, hooray for efficiently and skipping everything else. Go straight to step 9.
For me though, I wasn’t so lucky and had to do a bit more. If you’re as unfortunate as me, continue along!
Update your .bash-profile file to look in our ~/bin directory
4. Go to your home directory again:
5. Open up your .bash-profile file (in vim or whichever other text editor you can use until we get Sublime in there!):
6 (I know Vim). If you know Vim or whichever other text editor you used above, just add the following to the end of the file:
Wha? What is this vim you speak of?
6 (I don’t know Vim). Not sure how to use Vim? Follow along!
Firstly press the letter “i” on your keyboard to get into insert mode.
Then type in:
Press “esc” to leave insert mode.
Type in this to save your file and close it:
Testing if our update worked!
7. Close your terminal and open it again.
8. Type in:
Hopefully that comes up with help text that starts with “Sublime Text 2 Build…”. If so, tis happy times!
Opening up files
9. Now to open any file, you can use the subl command like so:
Have fun with your newly Terminally-accessible Sublime Text 2!