3

I have a beautifully set .bash_profile and everything was working well, then I updated to zsh. I installed Visual Studio for Mac, for a while I didn't realise that something was wrong, today I saw that all my paths were gone and I could only see the ones below when I echo:

/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/share/dotnet:~/.dotnet/tools:/Library/Apple/usr/bin:/Library/Frameworks/Mono.framework/Versions/Current/Commands

It's what I have in /etc/paths and my Visual Studio paths. Now I tried setting the source, but this only works during the current session, when I close and open my terminal again, it resets back to this broken one.

I looked through my files, I don't have a .profile or a .bashrc either. I even tried turning my Mac off and on again.

my .bash_profile:

export PATH="/usr/local/opt/node@10/bin:$PATH"
export ANDROID_HOME=/Users/me/Library/Android/sdk
export PATH=$PATH:$ANDROID_HOME/emulator
export PATH=$PATH:$ANDROID_HOME/tools
export PATH=$PATH:$ANDROID_HOME/tools/bin
export PATH=$PATH:$ANDROID_HOME/platform-tools
export PATH=/Users/me/flutter/bin:$PATH
export NVM_DIR=~/.nvm
source ~/.nvm/nvm.sh

export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"  # This loads nvm bash_completion

How can I make my Terminal just read .bash_profile?

7
  • Your $PATH is not broken but it contains the standard paths after installing a subset of Visual Studio for Mac (system defaults & Mono, dotnet). What's the content of your .bash_profile?
    – klanomath
    Commented Mar 31, 2020 at 3:52
  • @klanomath I have added my .bash_profile to the question. I also assumed it was like you said but I couldn't find anywhere how Visual Studio does this.
    – Aegletes
    Commented Mar 31, 2020 at 9:20
  • 1
    What is in the nvm.sh script? It could be overwriting the path when you source it. Maybe try moving all the nvm loading stuff to before your export statements?
    – compuphys
    Commented Mar 31, 2020 at 10:06
  • just tried that now @compuphys it does no effect unfortunately. The same thing is happening. That last part is just to run nvm as far as I know.
    – Aegletes
    Commented Mar 31, 2020 at 12:54
  • I'm not sure what's going on here then but you can try using the following links to hunt down the problem. Determine the type of shell you're in, then look at this flow chart to see which files are loaded and in which order.
    – compuphys
    Commented Mar 31, 2020 at 13:17

1 Answer 1

3

For anyone who experiences this issue, I apparently it was broken after my zsh update.

Found the solution here:

.bash_profile is a file read only by bash, which is not compatible with zsh. If we start sourcing .bash_profile bad things will start to happen. Instead, you should copy those ENV vars to the .zshrc file, preferably at the end of it.

Apparently you have to put everything into .zshrc instead of .bash_profile after this update. Some things might work a little different, btw, e.g. PROMPT colors. That wasn't an issue in this case, though.

Note that like with bash, there's a bunch of other files that may be sourced depending on the kind of shell you open that can contain various different settings, see here for a related question.

4
  • Ahh. You really should have mentioned you were using zsh and not bash ...
    – compuphys
    Commented Apr 1, 2020 at 7:43
  • To be a bit nitpicky: Nobody is going to experience the issue from the question as that wasn't the issue that happened. :) If I get your self-answer right it was merely a coincidence that you installed MS VS around the time you updated to Catalina, right? Because that was what changed the default shell from bash to zsh. I suggest you update your question accordingly, then that will surely help others in the future! Btw, welcome to the community!
    – Gero
    Commented Apr 1, 2020 at 7:58
  • @compuphys sorry about that you are right like Gero said it was a complete coincidence for me and I didn't realise what's happening. Thank you for your help :)
    – Aegletes
    Commented Apr 1, 2020 at 13:48
  • @Gero you are right, I will update it accordingly
    – Aegletes
    Commented Apr 1, 2020 at 13:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .