Sublime Forum

Setup Command Line Interface on Mac Problems

#1

I have macOS Big Sur version 11.4. I typed subl in my Mac Terminal, but it said “command not found: subl”. Why is that? I see /Applications/Sublime Text.app/Contents/SharedSupport/bin already have a subl Unix Executable File in there.

Please show how to set up subl so when I am in Terminal I can use that command to open Sublime Text.

Thank you,
Kim

0 Likes

#2

You see that error when the OS doesn’t know where to look to find the program you’re trying to execute.

Documentation for how to set this up for Sublime can be found here: https://www.sublimetext.com/docs/command_line.html

0 Likes

#3

I read that section, but still don’t understand it. It says, “To use subl, the Sublime Text bin folder needs to be added to the path. For a typical installation of Sublime Text, this will be located at /Applications/Sublime Text.app/Contents/SharedSupport/bin.” As I said, I saw bin already there, so how do I add it?

0 Likes

#4

That’s telling you what you need to add to the PATH; the sections immediately below it labeled BASH and ZSH had the instructions; pick the one for the version of MacOS that you’re using.

0 Likes

#5

Ok, I used ZSH for my macOS Big Sur. I went into Terminal and entered this on the command line “echo 'export PATH=”/Applications/Sublime Text.app/Contents/SharedSupport/bin:$PATH"’ >> ~/.zprofile"

I hit Enter, no errors, but when I typed subl, it still says zsh: command not found: subl

Why is that? Please advise. Thanks!

0 Likes

#6

You need to reopen the terminal for the change to take effect; the file you created with that command is only loaded when the terminal starts.

0 Likes

#7

It worked :slight_smile:

Thank you for your help!

0 Likes