0

macOS Catalina,使用自制软件安装 jenv 0.5.4,使用 zsh,遵循https://www.jenv.be/中列出的所有步骤

在终端我有以下错误

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

下面是来自 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

任何帮助,非常感谢。

4

1 回答 1

0

我刚刚在 mac 上遇到了同样的问题——这是因为文件夹 /Users/username/.jenv 已被锁定。

我找不到解锁它的方法,所以我只是将它复制到另一个目录,然后运行sudo rm -rf /Users/username/.jenv ,将它复制回来,这样就解决了问题。

于 2021-07-05T15:24:34.140 回答