0

macOS Catalina, installed jenv 0.5.4 using homebrew, using zsh, followed all the steps listed in https://www.jenv.be/

In terminal I have the following error

Last login: Tue Dec 22 10:10:15 on ttys002
/usr/local/Cellar/jenv/0.5.4/libexec/libexec/jenv-refresh-plugins: line 14: /Users/username/.jenv/jenv.version: Permission denied

The below is the code from jenv-refresh-plugins

#!/usr/bin/env bash
# Summary: Refresh plugins links

resolve_link() {
$(type -p greadlink readlink | head -1) "$1"
}       
               
set -e
[ -n "$JENV_DEBUG" ] && set -x

FORCE_REFRESH=0

if [ ! -f "${JENV_ROOT}/jenv.version" ]; then
 echo "NONE" > ${JENV_ROOT}/jenv.version
fi

if [ "$1" = "--complete" ]; then
echo "--force"
exit
fi

if [ "$1" = "--force" ]; then
FORCE_REFRESH=1
fi


lastVersion=$(cat "${JENV_ROOT}/jenv.version" || echo "none")
currentVersion=$(jenv --version)


if [ ! "$lastVersion" == "$currentVersion"  ] || [ $FORCE_REFRESH == "1" ]; then
 echo "jenv has been updated, process to refresh plugin links"
 for path in "${JENV_ROOT}/plugins/"*; do
     if [ -L "$path" ]; then
     pluginName=$(basename $path)
     echo "Refresh plugin $pluginName"
     ln -sfn  "${JENV_INSTALL_DIR}/available-plugins/$pluginName" "${JENV_ROOT}/plugins/$pluginName" 
     fi

 done
fi

echo "$currentVersion" > "${JENV_ROOT}/jenv.version"
jenv doctor 
[OK]    No JAVA_HOME set
[OK]    Java binaries in path are jenv shims
[OK]    Jenv is correctly loaded

Any help, much appreciated.

mch13
  • 1

1 Answers1

0

I just experienced this same issue on mac- it was caused because for some reason the folder /Users/username/.jenv had become locked.

I couldn't find a way to unlock it, so i just copied it to another directory, then ran sudo rm -rf /Users/username/.jenv , copied it back, and that has solved the problem.

MD1357
  • 111
  • 1
  • 4