Sublime Forum

Subl command not recognized in command prompt

#1

Iā€™m brand new to Ruby and Rails, so sorry if this is a totally ridiculous question. The tutorial book that Iā€™m reading says that I should be able to launch a Gemfile in Sublime Text directly from the command prompt using the subl Gemfile command. When I try this, I get an error that says ā€œsubl is not recognized as an internal or external command, operable program, or batch fileā€.

I am in the right directory where the Gemfile is located.
Ruby is definitely installed and I am using the command prompt with Ruby and Rails.
Some searches online that I looked through mentioned something about having to add Sublime to the pathā€¦not sure if this would help or how to do this.
I initially had Vim as a text editor, and it would launch by itself from the command prompt. I uninstalled Vim after finding Sublime, so that may have something to do with the problem.

I can always go to Sublime Text manually and open the Gemfile, but I hate not understanding why something isnā€™t working as expected. Any advice would be really appreciated.

0 Likes

#2

Hey, Iā€™m a beginner with Rails (and programming) too and had this same issue which I have now resolved. Thereā€™s 2 things I had to do.
Note: Windows 7 64 bit, Sublime Text 2 beta.

  1. Add the Sublime directory to the windows PATH
  2. I think ā€˜sublā€™ is a Mac-only command. For Windows itā€™s ā€˜sublime_textā€™

To add Sublime to the PATH:

  1. Right click Computer -> Properties -> Advanced System Settings -> Environment Variable
  2. Under ā€˜System Variablesā€™ select variable: Path and hit ā€˜Editā€™.
  3. At the end of the ā€˜Variable valueā€™ text field, add a semicolon and enter the Sublime Text directory (for me it was ā€˜C:\Sublime Text 2ā€™ but the default is C:\Program Files\Sublime Text 2)
  4. OK, OK, OK

Then, in the prompt go to the appropriate directory and try ā€˜sublime_text .ā€™

0 Likes

#3

Thanks @rockxwlā€¦I gave it a shot but itā€™s a no go. It might be a Win Vista thing (I donā€™t think so). Maybe I should try Sublime Text 2.

0 Likes

#4

Add the path and then just rename the sublime_text.exe to subl.exe and you will be ready to go :smile:

0 Likes

#5

I have got the same problem. Real helps, thank u:grinning:

0 Likes