Trying to source bashrc: No such file or directory
Solution 1
Your installation of OpenFoam4 is broken as on installation on my Xenial system there is quite a comprehensive /opt/openfoam4/etc/bashrc
configuration file in place that is appropriately sourced from the user file ~/.bashrc
.
I strongly suggest that you reinstall the application to correct missing files in /opt
. For Trusty and Xenial make sure you have followed these steps:
sudo add-apt-repository http://dl.openfoam.org/ubuntu
sudo sh -c "wget -O - http://dl.openfoam.org/gpg.key | apt-key add -"
sudo apt-get update
sudo apt-get -y install openfoam4
Then add the following line to ~/.bashrc
, making sure that it is only there once:
source /opt/openfoam4/etc/bashrc
To test this run the following commands, as demonstrated on my own system:
andrew@athens:~$ source ~/.bashrc
andrew@athens:~$ simpleFoam -help
Usage: simpleFoam [OPTIONS]
options:
-case <dir> specify alternate case directory, default is the cwd
-noFunctionObjects
do not execute functionObjects
-parallel run in parallel
-postProcess Execute functionObjects only
-roots <(dir1 .. dirN)>
slave root directories for distributed running
-srcDoc display source code in browser
-doc display application documentation in browser
-help print the usage
Using: OpenFOAM-4.0 (see www.OpenFOAM.org)
Build: 4.0-665f1db4c1f1
andrew@athens:~$
And you should now see a very comprehensive configuration file in place at /opt/openfoam4/etc/bashrc
...
References:
Solution 2
The error message tells you that the file /opt/openfoam4/etc/bashrc
(which you try to source from ~/.bashrc
) does not exist. It's not complaining about your ~/.bashrc
file in itself.
Related videos on Youtube
E. Graz
Updated on September 18, 2022Comments
-
E. Graz almost 2 years
I'm trying to install openfoam4. I have installed it and edited the .bashrc file to have the line:
source /opt/openfoam4/etc/bashrc
I tried to run:
source ~/.bashrc
and get:
bash:/opt/openfoam4/etc/bashrc: file not found
When I run
ls -la ~/ | more
I see the .bashrc file as well as some .bashrc.swm and .bashrc.swn files. I know they were created by exiting the editor incorrectly.How do I fix this?
-
insert_name_here almost 8 years
.bashrc
(with a period in front of it) is not the same asbashrc
. Try changing yoursource
line tosource /opt/openfoam4/etc/.bashrc
-
Neni almost 8 yearsFile /opt/openfoam4/etc/bashrc does not exist, the error occurs when the file is sourced within ~/.bashrc. Type: ls -A /opt/openfoam4/etc and check the files there, I think you have a typo, as suggested above, it could be '.bashrc' instead of 'bashrc'.
-
E. Graz almost 8 yearsThe output is: ls: cannot access 'opt/openfoam4/etc/bashrc': no such file or directory
-
E. Graz almost 8 yearsI typed the line: ls -A /opt/openfoam4/etc and it said there was no file or directory
-
E. Graz almost 8 yearsand I see that my .bashrc file is in /home/eric Is this correct?
-
E. Graz almost 8 yearsHere is the installation file I'm trying to follow: complete the following Open the .bashrc file in the user’s home directory in an editor, e.g. by typing in a terminal window (note the dot) gedit ~/.bashrc At the bottom of that file, add the following line (see Note 1 below) and save the file source /opt/openfoam4/etc/bashrc Open a new terminal window (see Note 2 below) and test that the simpleFoam application, from the OpenFOAM package, is working by typing simpleFoam -help A “Usage” message should appear. Your installation and user configuration is complete.
-
andrew.46 almost 8 yearsTry:
sudo mkdir -pv /opt/openfoam4/etc && sudo touch /opt/openfoam4/etc/bashrc
For others see here: openfoam.org/download/4-0-ubuntu -
E. Graz almost 8 yearsThank you andrew.46. I made the directories but couldn't run: simpleFoam -help. It read siplefoam: command not found
-
andrew.46 almost 8 years@E.Graz I installed openfoam on my own system and my suspicion is that you have a faulty installation with some missing config files at least. Have a look at my answer and see if it fixes the issue...
-