How to Use OpenFOAM with ZSH

If you use zsh as the shell of your terminal on Ubuntu, you may encounter the following error message for OpenFOAM:

/home/xxx/OpenFOAM/OpenFOAM4/etc/config.sh/aliases:73: bad option: -t

To resolve this problem, first, the path to OpenFOAM should be written in ~/.zshrc, which is also supposed to be included in ~/.bashrc, as:

source /opt/openfoam4/etc/bashrc

Then,go to /opt/openfoam4/etc/config.csh to edit the aliases in line 73. More specifically, change

[ "$(type -t wmRefresh)" = "alias" ] && unalias wmRefresh || unset wmRefresh

to

[ "$(type wmRefresh | awk '{print $4}')" = "alias" ] && unalias wmRefresh || unset wmRefresh

Afterwards, the error is solved.

That is it.
Cheers!

Reference:
OpenFOAM 4.0, bad option -t in zsh
OpenFOAM 4.0 を Ubuntu 12.04 LTS にインストールメモ