Mac Terminal error: -bash: /Users/tim/.profile: No such file or directory

I encountered this issue after I switched to an M1 chip MacBook. I found the solution, follow these steps should fix the issue:

1st: Add below codes to ~/.bash_profile (simply run this code in Terminal)

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

2nd: Run the below codes in Terminal

source ~/.bash_profile

This should fix the issue, you can check nvm -v. However, if the issue persists, try the below steps:

Open the ~/.zshrc file, and add the below codes at the top of the file and save.

source ~/.bash_profile

source ~/.zshrc

(if you don't know how to access the ~/.zshrc add whatever code editor in front of it in Terminal, I use VS code thus code ~/.zshrc). This should fix the issue.


This happened to me as well and I noticed that at the top of my .bash_profile it had:

source ~/.profile

My understanding is that on MacOS / OS X .bash_profile is given priority over .profile so the latter file isn't required.

To fix therefore I simply removed source ~/.profile from the top of the file.

Hope that helps.

Edit: original poster commented that he just created a blank .profile to solve this as well.


I met the same issue today, i guess it's because i use the cleaning app and the app considered this file was a waste of space so deleted it. touch ~/.profile helps me.

Tags:

Terminal