Happy to have been of help.

Best,

-ranga

> On May 5, 2022, at 10:11, Jean Bermudez <etereoc...@gmail.com> wrote:
> 
> Thank you very much! This fixed my problem. I have zsh 5.8.1 as the default 
> shell and I can run NeoVim without problems.
> 
> El lun, 2 may 2022 a las 16:33, Sriranga Veeraraghavan 
> (<srira...@berkeley.edu <mailto:srira...@berkeley.edu>>) escribió:
> Hi Jean,
> 
> Is /opt/local/bin/zsh in your /etc/shells now?  You can check as follows:
> 
> /usr/bin/grep -i zsh /etc/shells
> 
> If this includes /opt/local/bin/zsh, then you can probably use 
> /opt/local/bin/zsh as a valid login shell.  If so, you can now probably try 
> the following to change your shell:
> 
> /usr/bin/chsh -s /opt/local/bin/zsh
> 
> This should probably change your login shell to /opt/local/bin/zsh.  This was 
> the same command that was in my prior email, except that it omits the ‘$’ 
> character, which, by convention, is the default shell prompt and should not 
> be treated as part of the command.
> 
> I think the rest of your problems may be due to the PATH environment variable 
> not being set properly.  For zsh, I would suggest that you set up your PATH 
> environment variable as follows:
> 
> /bin/echo 'export 
> PATH="/opt/local/bin:/bin:/sbin:/usr/bin:/usr/sbin:/opt/local/sbin:/usr/local/bin:/usr/local/sbin"'
>  > ~/.zshenv
> 
> For your reference, the PATH environment variable is a list of all the 
> directories that your shell (zsh or bash) will look in for commands.  The ‘:’ 
> character separates the directories.  The order in which the directories are 
> listed is important.  In the above, /opt/local/bin is ahead of all of the 
> other directories, so that you will get the MacPorts versions of commands 
> rather than the versions that are in other directories (the Apple provided 
> versions are usually in /bin or /usr/bin).  
> 
> HTH,
> 
> -ranga
> 
> > On May 2, 2022, at 12:55, Jean Bermudez <etereoc...@gmail.com 
> > <mailto:etereoc...@gmail.com>> wrote:
> > 
> > Hi! Thank you for your answer!
> > 
> > I was trying a few things before your reply. In the #macpports channel on 
> > libera.chat, 
> > they recommended me to run this: echo "/opt/local/bin/zsh" | sudo tee -a 
> > /etc/shells
> > 
> > ...to set my user's login shell to /opt/local/bin/zsh.
> > 
> > After that they was recommended me to run: "chsh -s /opt/local/bin/zsh" to 
> > set zsh as default shell.
> > 
> > I tried that, and everything continued the same way. I commented that when 
> > I use the command "echo $ZSH_VERSION" the answer is 5.8.1 (the installed 
> > version of MacPorts), instead when I use the command "zsh -version" it 
> > answers me 5.3 (the High Sierra version).
> > 
> > Faced with this, in the #macports chat on libera chat I got the following 
> > response:
> > 
> > - $ZSH_VERSION is what your current shell is
> > - zsh --version is whatever is first in your $PATH
> > - which also explains why it works for bash - your $PATH contains 
> > /opt/local/bin before /bin
> > - That also explains why it works for zsh started from bash, because that 
> > usually keeps $PATH the same, so /opt/local/bin is again before /bin
> > - See https://guide.macports.org/#installing.shell.postflight 
> > <https://guide.macports.org/#installing.shell.postflight>
> > - $PATH is btw also the reason why the nvim command doesn't work.
> > - export PATH=/opt/local/bin:$PATH; hash -r; nvim will probably work in all 
> > shells
> > 
> > When I use "export PATH=/opt/local/bin:$PATH; hash -r; nvim" NeoVim starts, 
> > but when I close the terminal and try to open NeoVim with the command 
> > "nvim" I get as response "nvim: command not found".
> > 
> > Additionally trying some things, I used this command "cat > 
> > ~/.bash_profile" which brought me some problems. I had to reset 
> > .bash_profile.
> > 
> > Now when I run "nvim" I cannot access NeoVim from any of the SHELLS. The 
> > only way I can access NeoVim currently is by using "export 
> > PATH=/opt/local/bin:$PATH; hash -r; nvim".
> > 
> > I tried the commands you recommended.
> > - sudo /bin/sh -c '/bin/echo /opt/local/bin/zsh >> /etc/shells'. 
> > In response I get an empty command line with a ">" at the beginning.
> > 
> > - $ /usr/bin/chsh -s /opt/local/bin/zsh
> > - $ /bin/echo 'PATH="$PATH:/opt/local/bin:/opt/local/sbin"' >> ~/.zshenv
> > In response to these last two commands I get: -bash: $: command not found
> > 
> > 
> > El lun, 2 may 2022 a las 15:04, Sriranga Veeraraghavan 
> > (<srira...@berkeley.edu <mailto:srira...@berkeley.edu>>) escribió:
> > 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 <etereoc...@gmail.com 
> > > <mailto:etereoc...@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?
> > 
> 

Reply via email to