zsh problems MacOS High Sierra

Sriranga Veeraraghavan sriranga at berkeley.edu
Mon May 2 19:04:15 UTC 2022


Hi Jean,

I think that this isn’t working for you because MacPorts generally installs programs in /opt/local/bin.  

If you have installed zsh using MacPorts and you want to make the MacPort’s version of zsh your default shell, you’ll probably need to do something like the following:

$ sudo /bin/sh -c '/bin/echo /opt/local/bin/zsh >> /etc/shells’ 
$ /usr/bin/chsh -s /opt/local/bin/zsh

The first line adds /opt/local/bin/zsh to /etc/shells as a permitted login shell.  The command you were using only designated the Apple provided zsh, /bin/zsh, as a permitted login shell.  

The second line changes the default shell to /opt/local/bin/zsh.  The command you were using probably didn’t accomplish this for you because ${prefix} is a variable used to specify the MacPorts directory, which probably wasn’t defined.  I believe the MacPorts instructions use ${prefix} rather than /opt/local because it is technically possible to install MacPorts in a location other than /opt/local.

Regarding nvim, the reason that zsh can’t find it is probably that the directory /opt/local/bin is not included zsh's PATH environment variable.  I am not a zsh user, but I believe that you can probably fix this as follows:

$ /bin/echo 'PATH="$PATH:/opt/local/bin:/opt/local/sbin"' >> ~/.zshenv

With respect to the extra entries in /etc/shell, my guess is that, if the above steps gets things working for you, can just leave that file alone and it will not affect anything on your system.  If you want, you can edit that file and remove the extra entries. 

Please note, if you are using Terminal.app it still may not use the MacPort’s version of zsh as the default shell because I believe that Terminal.app has a separate preference that can be used to define the shell for new Terminal windows/tabs.  

I don’t have High Sierra installed on any of Macs, but I believe that if you open the Preferences windows in Terminal.app and then click on the General tab / button, you will see a setting that reads something like “Shells open with:”.  This preference setting should allow you to configure which shell is used by Terminal.app.  You many need to change the setting to ‘/opt/local/bin/zsh’ to use the MacPorts version of zsh.

HTH,

-ranga

> On May 2, 2022, at 08:22, Jean Bermudez <etereocode at gmail.com> wrote:
> 
> Hi there! 
> 
> I installed "NeoVim" and "zsh" via MacPorts on MacOs High Sierra.
> 
> I have a problem. High Sierra comes with "zsh" version 5.3 installed by default. I noticed this after I installed zsh version 5.8.1 via MacPorts.
> 
> How did I figure it out?
> - I changed the default shell (bash) to "zsh" via the command "chsh -s /bin/zsh".
> - I tried to start NeoVim with the command "nvim".
> - And the system responded "zsh: command not found: nvim".
> - After trying several things, I entered the command "zsh -version" and the version that was active was 5.3 (High Sierra).
> - I went back to the "bash" shell and simply entered the command "zsh" to use the zsh shell, and when I checked the version (zsh -version) the version was 5.8.1 (MacPorts). I entered the command "nvim" and it worked.
> 
> I got desperate looking for a solution and entered several times the command you provide on your site to set MacPorts': sudo sh -c 'echo ${prefix}/bin/zsh >>/etc/shells'.
> 
> Now when I check the list of Shells with "cat /etc/shells". I get "/bin/zsh" four times.
> 
> I want to delete all zsh and install only the MacPorts "zsh" cleanly; and then set that shell to default.
> 
> How do I do this?



More information about the macports-users mailing list