Skip to content

etc/cshrc on Mac OS X

Summary

etc/cshrc does not work on Mac OS X.

  1. Original version exists with
% source etc/cshrc 
sed: 1: "s@^[^/]*@@;\@/OpenFOAM[ ...": extra characters at the end of q command
Error: did not locate installation path for OpenFOAM-v1912
No directory: 
  1. It sets up LD_LIBRARY_PATH instead of DYLD_LIBRARY_PATH.

Steps to reproduce

source etc/cshrc

What is the current bug behaviour?

Error:

sed: 1: "s@^[^/]*@@;\@/OpenFOAM[ ...": extra characters at the end of q command
Error: did not locate installation path for OpenFOAM-v1912
No directory: 

What is the expected correct behavior?

  1. Environment is set up.
  2. DYLD_LIBRARY_PATH is set instead of LD_LIBRARY_PATH.

Environment information

  • OpenFOAM version : 1912
  • Operating system : Mac OS X (10.15.4)
  • tcsh version : tcsh 6.21.00 (Astron) 2019-05-08 (x86_64-apple-darwin) options wide,nls,dl,bye,al,kan,sm,rh,color,filec

Possible fixes

  1. sed issue can be fixed by adding ; after q command. I.e.
set projectDir=`lsof +p $$ |& \
    sed -ne 's@^[^/]*@@;\@/'"$projectName"'[^/]*/etc/cshrc@{s@/etc/cshrc.*@@p; q; }'`

On Linux (tested on Ubuntu 19.10) this addition does not change behaviour.

  1. Use DYLD_LIBRARY_PATH on Mac OS X. I have tried to fix the issue, see attached config.csh.patch. Not sure if it conforms with tcsh programming style guide. Also it is not quite clean what to do if system Open MPI is installed in /usr/local/...: it is added to [DY]LD_LIBRARY_PATH during environment setup but is not cleaned during wmUnset.

As a side-note: etc/cshrc works only in tcsh. With real csh (Ubuntu's 20110502-5, which is based on csh from OpenBSD source tree) it exits with Invalid null command. error.