Sublime Forum

From terminal to editor

#1

Hello, how can I open a program from my terminal? I’m a beginner and in my university there is only Linux. For opening a program they type:” gedit hello.c & “ and it creates a program. How can I do the same thing with my Mac and Sublime? thank you

0 Likes

#2

subl hello.c&

0 Likes

#3

tank you again

0 Likes

#4

You can use oh my zsh to open sublime in terminal.

0 Likes

#5

if I use your command it still doesn’t function

[1] 1052
-bash: subl: command not found
[1]+ Exit 127 subl hello.c

0 Likes

#6

In Terminal, run the following command:

ln -s '/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl' /usr/local/bin/subl

now subl should work for you.

The command ln creates links. With the -s option it creates a symbolic link. The first argument is the source of the link, the second argument is the target of the link.

In the command above, we “link” the subl executable to /usr/local/bin/subl. The directory /usr/local/bin is in your list of directories that bash/zsh looks for when you try to invoke a command.

So, when you type subl, it should resolve to /usr/local/bin/subl. You can check this by running the command

which subl

For me, that prints /usr/local/bin/subl. The symbolic link should then resolve it to the executable sitting in the /Applications folder. You can check that by running the following command:

ls -lash /usr/local/bin/subl

For me, that prints

0 lrwxr-xr-x  1 raoulwols  admin    62B  4 aug  2017 /usr/local/bin/subl -> /Applications/Sublime Text.app/Contents/SharedSupport/bin/subl
1 Like