Enabling Sublime Text for Command Line Use

I have been using Sublime Text 2 on my PC for a few months and now that I have a Mac, I got around to installing it today. I have been used to modifying scripts and code snippets from the command line by using “subl <filename>”. Unfortunately, that didn’t work after installing Sublime. I’ve read other blog and seen people use it so I figured that it was just an error after installation. Let’s fix it!

The first thing we need to do is create a .bash_profile file if we don’t have one already.

touch ~/.bash_profile

Then we can add this nifty alias to our .bash_profile:

alias subl=”/Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl”

Finally, reload that bad boy

source ~/.bash_profile

This was a head scratcher but a quick fix.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s