'zsh permission denied while setting path for grails 2.5.6 and groovy 2.4.q0

./zshrc file:

export JAVA_HOME=$(/usr/libexec/java_home -v 12)

export GROOVY_HOME=$($HOME/groovy-2.4.10)
export PATH=$PATH:$GROOVY_HOME/bin

error in terminal:

/.zshrc:3: permission denied: /$HOME/groovy-2.4.10

also i am not able to install any



Solution 1:[1]

You have an extra $(...):

export GROOVY_HOME=$($HOME/groovy-2.4.10)

should be

export GROOVY_HOME=$HOME/groovy-2.4.10

$(...) tries to execute the code in the parens and return its output. But you want to point GROOVY_HOME to a folder, not execute the folder (which you can't, hence the error). For setting JAVA_HOME you do need the $(...) cause you run the /usr/libexec/java_home command and assign its output to JAVA_HOME.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Robert