macosantenvironment-variableszshzshrc

Permission denied when setting environment variable on macOS


I'm trying to install apache ANT 1.10.14. I downloaded the binary configuration from this page. I then moved the unzipped 'apache-ant-1.10.14' to my home directory. As the setup guide suggests, I need to set the ANT_HOME environment variable to the bin directory contained inside the downloaded directory. Here's the assignment I'm performing inside my .zshrc file:

#I'm not sure if I should be adding '/bin' to the ANT_HOME path as I add it in the PATH variable

export ANT_HOME =$(/Users/me/apache-ant-1.10.14)
export PATH = $PATH:$ANT_HOME/bin

In both cases (adding '/bin' to ANT_HOME or not), after closing the file and executing source ~/.zshrc, I get the following error:

/Users/me/.zshrc:11: permission denied: /Users/me/apache-ant-1.10.14
/Users/me/.zshrc:11: bad assignment

Solution

  • I needed to remove the blank spaces before and after = and not use $(...) syntax since apache-ant-1.10.14 is not an executable program.

    export ANT_HOME=/Users/mauri5566/apache-ant-1.10.14
    export PATH=$PATH:$ANT_HOME/bin