Sublime Forum

Sublime Text 3 to use zsh shell

#1

When I try to build a Ruby file I get the following:

/bin/bash: ruby: command not found
[Finished in 0.0s with exit code 127]

I am not using bash, but zsh. I have searched google and the configuration, but where can I define the path Sublime Text should use for my shell?

0 Likes

#2

It would be much clearer if you posted the header of the file…

0 Likes

#3

Thanks for your response. Which file do you mean? In the Ruby file there isn’t anything special, just straight into Ruby syntax.

Anyway, I did find out that when I start subl from the terminal in zsh all works well. So I think the scope on my question just changed and should be how to make the x window launcher use zsh as my env variable instead of bash.

0 Likes

#4

I am cross posting this in Linux Mint and Sublime.

Sublime apparantly does look for bash by itself.

forums.linuxmint.com/viewtopic.p … 04#p913804

0 Likes

#5

My problem is related to what is described here:

sublimetext.com/forum/viewt … f=3&t=6938

For Mac, someone wrote a plugin fix:
github.com/int3h/SublimeFixMacPath

Someone else made a more simple one:
robdodson.me/blog/2012/05/14/hac … lime-text/

Neither is working for me. Sublime will only look at /bin/bash.

When I start Sublime from my terminal it works fine.

0 Likes

#6

after installed github.com/int3h/SublimeFixMacPath
you can create something like this in your settings - user
{
“additional_path_items”:

		"/usr/bin",
		"/bin",
		"/sbin",
		"/usr/local/bin",
		"/opt/X11/bin",
		"/Users/kendallsv/Android_SDK/platform-tools",
		"~/.composer/vendor/bin/phpcs",
		"~/.composer/vendor/bin/phpcbf",
		"/Users/kendallsv/pear/bin"
	]

}
where “kendallsv” of course is the my user name on my computer, those locations are the same locations I use on my .zshrc file, so whatever I can run on my regular terminal I will be able to run it in the terminal inseide Sublime, so for example now the code sniffer command phpcs is working as expected, probably someone else could have a better solution, but at least this worked for me

0 Likes

#7

I asked the same question on stackoverflow(> http://stackoverflow.com/a/38574286/6631854) and solved the problem.
Method:
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.

0 Likes

#8

I generally wouldn’t recommend that, unless you redo the process with new releases. We definitely make improvements and bug fixes to exec.py, and have especially over the past few releases.

1 Like

Onwards to 3.1
#9

Whoop; I usually make sure to mention that particular aspect to make sure it doesn’t bite people but I forgot there. I’ve edited my answer to reflect this and that it’s really better to just fix the path problem and not try to hack around it like this.

0 Likes

#10

I have “the same” issue
I use bash 4.4 installed in /usr/local/bin via homebrew

PATH and launchctl is correctly set but sublime reports errors because it still uses bash 3.x

seeing that this is a pretty old issue, is there some “good” way to fix it instead of using a 3 year old plugin or hacking the source? (which I am not very confident with)

Tried the latest dev built and the issue is still present.

thanks

0 Likes

#11

What kind of “the same” issue do you have? For a several latest dev builds I see this in console:

environment variables loaded using: /usr/local/bin/zsh -l

And Sublime sees all my env variables without any tweaks.

0 Likes

#12

I suspect @14b56 is referring to build systems not using the default shell, judging by this similar issue recently logged:

2 Likes

#13

sorry for not being specific

I hope it is sufficient to link to this GitHub thread
opened GitHub issue

I basically get

/usr/local/share/bash-completion/bash_completion: line 1897: declare: -A: invalid option
declare: usage: declare [-afFirtx] [-p] [name[=value] ...]
/usr/local/share/bash-completion/bash_completion: line 2060: complete: -D: invalid option
complete: usage: complete [-abcdefgjksuv] [-pr] [-o option] [-A action] [-G globpat] [-W wordlist] [-P prefix] [-S suffix] [-X filterpat] [-F function] [-C command] [name ...]
~/.bash_profile: line 154: shopt: autocd: invalid shell option name

every time I built something

edit: kingkeith was faster
really responsive team in here, great

0 Likes

#14

out of my misery I decided to try modifying exec.py but the Package Resource Viewer would not open it
Is this somehow changed in the most recent sublime built?

thanks

0 Likes

#15

the python script does not work for me on later macOS + 3133 either, modified the $HOME in the script and placed it accordingly but nope, same error :weary:

Fix Mac path did not work either, maybe this is because it is made for ST2
an option like they implemented would be the thing I’d like to see natively in ST3
"additional_path_items": ["/usr/local/bin"]
(actually working, not like in the plugin)

thanks

0 Likes

#16

I’ve been using zsh for a while now and decided to delete my .bashrc and ran into this problem with ST3 (on MacOS). The suggested plugin doesn’t work, so I’ve restored my .bashrc for now…

0 Likes