Adding a specific binary (zsh) to the $PATH?

2

I have installed a more recent version of zsh using homebrew, located at /usr/local/bin/zsh.

which zsh returns /bin/zsh.

How can I make /usr/local/bin/zsh the default, without adding the entire /usr/local/bin directory to the beginning of my $PATH?

Tom

Posted 2013-03-29T22:56:38.153

Reputation: 21

Ugly but working:

Add ~/bin to your path before the /bin entry. Then create a [soft] link to /usr/local/bin/zsh – Hennes – 2013-03-29T22:59:32.140

why not add /usr/local/bin to the beginning of $PATH? – MattDMo – 2013-03-29T23:11:32.487

@MattDMo because I don't want everything in there to be used as default. – Tom – 2013-03-29T23:24:20.967

Answers

2

Just symlink it to /usr/bin or some other folder before /bin:

sudo ln -s /usr/local/bin/zsh /usr/bin/

If you want to change the login shell, add /usr/local/bin/zsh to /etc/shells and run chsh.

I have /usr/local/bin before /bin on the path, and I haven't really run into any issues because of it. Some TextMate commands don't work with newer versions of Ruby or bash though.

Lri

Posted 2013-03-29T22:56:38.153

Reputation: 34 501

TextMate uses its own path that can be configured in case of problems – slhck – 2013-03-30T07:19:45.977

Yeah, but I also wanted to make #!/usr/bin/env bash bash 4. – Lri – 2013-03-30T09:03:26.107