Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Development Tools

Andrew Chappell
Andrew Chappell
12,782 Points

Cannot open Sublime Text 3 from Terminal like in Laravel Basics Course.

I'm following along with the Laravel install and tried the command sudo subl hosts from my home directory. This just returns sudo: subl: command not found.

I looked at this documentation from Sublime http://www.sublimetext.com/docs/3/osx_command_line.html and after pasting in their suggested code:

ln -s "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" ~/bin/subl

I get the following /Users/Chappell/bin/subl: No such file or directory

As far as I can see there is no file called subl in the bin directory.

3 Answers

Ah. So:

To set the environment variable, see the bottom of the page at the link you posted, under the heading EDITOR:

export EDITOR='subl -w'

Then, to apply the change, try:

source ~/.bash_profile

Restart your terminal program, then try the subl . command (that's "subl space period") in a directory you want to open in Sublime. I think this will work; there are a lot of variables, but that's the "simplest" version I know of. Worked for me.

Candice Eisner
Candice Eisner
10,514 Points

If things still aren't working after following James' instructions, try this suggestion from Stack Overflow, which sets the symlink to be in /usr/bin/subl instead of ~/bin/subl:

sudo ln -s /Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl /usr/bin/subl

http://stackoverflow.com/questions/16199581/opening-sublime-text-on-command-line-as-subl-on-mac-os

Candice Eisner
Candice Eisner
10,514 Points

Oh and forgot to add, this is how I've got it set up and it works :)

Andrew Chappell
Andrew Chappell
12,782 Points

Thank you both for that. It must have been a permissions issue because I was using exactly that line without sudo on the front. Working now.

Andrew, did you set the environment variable? And afterward, did you use the source command to apply changes?

Andrew Chappell
Andrew Chappell
12,782 Points

Thanks for replying. I didn't. How do i do that?