Description of problem: rhq-cli script uses option -f not supported on Mac OS X. http://stackoverflow.com/questions/1055671/how-can-i-get-the-behavior-of-gnus-readlink-f-on-a-mac Might be easiest to simply skip this behavior for this OS.
Here the proposed fix: # ---------------------------------------------------------------------- # Change directory so the current directory is the CLI home. # Here we assume this script is a child directory of the CLI home # We also assume our custom environment script is located in the same # place as this script. # ---------------------------------------------------------------------- command -v readlink >/dev/null 2>&1 if [ $? -ne 0 ]; then echo >&2 'WARNING: The readlink command is not available on this platform.' echo >&2 ' If this script was launched from a symbolic link, errors may occur.' echo >&2 ' Consider installing readlink on this platform.' _DOLLARZERO="$0" else # only certain platforms support the -e argument for readlink if [ -n "${_LINUX}${_SOLARIS}${_CYGWIN}" ]; then _READLINK_ARG="-e" _DOLLARZERO=`readlink $_READLINK_ARG "$0" 2>/dev/null || echo "$0"` elif [ -n "${_DARWIN}" ]; then _DOLLARZERO=$(cd `dirname "${BASH_SOURCE[0]}"` && pwd)/`basename "${BASH_SOURCE[0]}"` else _DOLLARZERO=`readlink "$0" 2>/dev/null || echo "$0"` fi fi
The strategy above is from: https://stackoverflow.com/questions/59895/can-a-bash-script-tell-what-directory-its-stored-in?lq=1
PR: https://github.com/rhq-project/rhq/pull/144
merged mike t's PR: commit 4835c7716fe6769138e1c1f3961ccd997425af5b Merge: 04fd135 f6d158b Author: John Mazzitelli <mazz> Date: Tue Oct 21 16:28:44 2014 -0400 Merge pull request #144 from rhq-project/bz1095508 Bz1095508 - MacOS - rhq-cli.sh script command fails with 'readlink: illegal option -- f put it in release 3.3 branch as well: commit afc5a92a74aa6da7a00d5b4b475232b00b244323 Author: John Mazzitelli <mazz> Date: Tue Oct 21 16:28:44 2014 -0400 Merge pull request #144 from rhq-project/bz1095508 Bz1095508 - MacOS - rhq-cli.sh script command fails with 'readlink: illegal option -- f(cherry pic Signed-off-by: John Mazzitelli <mazz>