Thanks for your reply.
I have now figured it out and it worked.
I did not change any of other environmental variables but did the following
- go to a terminal
- type emacs ~/.julia/prefs/MPI.toml
- set path = “/usr/local/Cellar/open-mpi/4.1.1_2”
It seems that the way of setting the path is different from the ways in the two links in my original post (see Error building MPI---ERROR: LoadError: libmpi could not be found) which were in the files ~/.bash_profile or ~/.profile
Maybe it’s Julia version thing