Terminal Cannot Find Bashrc File When Using Source Command

Terminal Cannot Find Bashrc File When Using Source Command

I recently downloaded mysql. What am I doing wrong when I source the bash file?

The path for my bashrc file is:

Users/Name/bashrc

(I moved it from a different location, can't remember from where, but I figure that if the path is right, it shouldn't matter)

In the terminal, I'm supposed to use:

source ~/.bashrc 

When I type that and press enter, it returns:

-bash: /Users/Name/.bashrc: No such file or directory

The bash file itself says:

source /etc/bash.bashrc
source ~/.bashrc
export PATH=$PATH:/usr/local/mysql/bin
10

1 Answer

You need to have the file .bashrc located in ~ to be able to source it. ~ expands to $HOME (/Users/Name in your case).

If the output of cd ~ && ls -la doesn't contain .bashrc, then you don't have that file, so you cannot source it.

Based on your comments, your file is ~/bashrc.sh (not a great name). If you delete the first two lines of this file, it will work properly. Note that you'll have to source this file every time you open a new terminal. You can add the line

export PATH=$PATH:/usr/local/mysql/bin 

to a file that gets automatically sourced upon login, like ~/.bash_profile, /etc/bash.bashrc (not recommended), or create a ~/.bashrc and include that line.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Sarah Jenkins
Author

Sarah Jenkins

Sarah Jenkins is a veteran tech journalist with over 12 years of experience covering artificial intelligence, mobile innovations, and digital ethics. Her insights have appeared in leading technology publications worldwide.