Search code examples
bashmacossublimetext3oh-my-zsh

OS X Sublime Text3 to use zsh shell


I want to build a python file I get the following error:

/bin/bash: python: command not found

The reason is that I'm using zsh instead of bash. So how to let Sublime to look at /bin/zsh?


Solution

  • This is indicative of your path not being correct and not what shell you normally use. In the case of OSX the path for GUI applications is set via different means than that of terminal programs (which you know based on your comments in your question above).

    Regardless, to answer your question (and for future reference) the exec command in Sublime, which is used to execute tasks including build systems, is what is specifying that things be executed via bash.

    Using PackageResourceViewer you can extract the file exec.py from the Default package and modify it's use of "/bin/bash" to "/bin/zsh" (or whatever other shell you want) as you see fit.

    [EDIT]

    While the above will work, when you override a file from a package like this, your override persists forever. That is to say, if a newer version of Sublime includes a different version of exec.py with bug fixes or newer features, you won't see them because you've overridden the file.

    So something to keep in mind is that if you take this route the onus is on you to always keep your override up to date with the current released version. Bug reports of exec problems are probably also going to fall on deaf ears or cause tears when it's discovered you've overridden the file.