Search code examples
pythonterminalcondazsh

something very weird happens when i try to find the conda path in terminal


i get the "conda not found issue" after installing conda and i went into my .zshrc to export the path to fix the issue.

I add this line "export PATH=${PATH}:/usr/local/opt/miniconda3/bin" to the .zshrc - still the same issue

When double checking the path i cd to /usr/local first, then i cd into the opt directory, i type ls and it shows nothing. i cd .. back to the local dir and then i ls opt - nothing.

The weird thing is that if i do "ls /opt" i can se miniconda 3, and when i cd /opt and ls I can se miniconda 3. and AFTER i have been in opt this time, if i go back to /local and then cd opt I can ls and se miniconda 3 again.

Output of my terminal after recreating the issue

enter image description here


Solution

  • If directories suddenly disappear and reappear again, I would not worry about a PATH issue. This seems to be the least problem. First of all, from what you wrote, you always have a /opt/miniconda3 directory available (no need to cd into the directory to see this), so I would put into your .zshrc

    PATH=$PATH:/opt/miniconda3/bin
    

    and forget about /usr/local.

    This should settle your problem with the PATH. If you also want find out, why it sometimes also shows up under /usr/bin and sometimes does not, I would suspect some process is creating a symlink there. It would make sense to monior the directory to find out when this creation happens.