Only call rbenv if rbenv is present.
Use more environment-safe syntax.
Only call brew if brew is installed.