问题
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
?
回答1:
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.
回答2:
If all that you need is to open zsh shell from sublime rather than the default bash shell, there is a simpler way to do this. On OSX/Mac, open perferences->package settings->terminal view->pallete commands. Change /bin/bash to /bin/zsh like below.
{
"args" : {"title": "Terminal (bash)", "cmd": "/bin/zsh -l"},
},
This works for sublime text 3. Have not tested for lower versions.
Hope this helps!! Cheers!!
回答3:
It work for me fine on Mojave.
sudo ln -s /Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl /usr/bin
来源:https://stackoverflow.com/questions/38568984/os-x-sublime-text3-to-use-zsh-shell