こんにちは。
pyenvの環境を構築し直していた際、source ~/.zshrc
をした際にのみ以下エラーが出るようになってしまいました。(cmd + q でターミナルを終了した後、再度起動した場合にはエラーは出ません。)
(eval):5: parse error near `()'
環境は macOS Catalina 10.15.2
私の設定ファイルは以下です。
.zshrc
export LANG=ja_JP.UTF-8
PROMPT='%F{6}%c%f $ '
# enable input candidates
autoload -Uz compinit
compinit
# add color selected input candidates
zstyle ':completion:*' menu select
# Do not keep the same command history
setopt HIST_IGNORE_DUPS
# zsh pure prompt theme enable -> clear "#" bottom two lines
# autoload -U promptinit; promptinit
# prompt pure
# alias
alias cdd="cd ~/dev"
alias pbc="pbcopy"
alias jl="jupyter lab"
alias v="vim"
alias g="git"
function mkblog() {
cd "$HOME/dev/blog/";
hexo new $1;
vi "./source/_posts/$1.md";
}
alias mkblog=mkblog
alias exa="exa --group-directories-first"
alias ls="ls -G"
export PATH="/usr/local/bin:$PATH"
# opam configuration
test -r $HOME/.opam/opam-init/init.zsh && . $HOME/.opam/opam-init/init.zsh > /dev/null 2> /dev/null || true
# Added by Zplugin's installer
source '$HOME/.zplugin/bin/zplugin.zsh'
autoload -Uz _zplugin
(( ${+_comps} )) && _comps[zplugin]=_zplugin
# End of Zplugin's installer chunk
# add Zplugin's
zplugin light zsh-users/zsh-autosuggestions
zplugin light zsh-users/zsh-syntax-highlighting
# config starship
eval "$(starship init zsh)"
# cargo path
export PATH="$HOME/.cargo/bin:$PATH"
# binutils
export PATH="/usr/local/opt/binutils/bin:$PATH"
# laravel path setting
export PATH="$HOME/.composer/vendor/bin:$PATH"
# Open MPI: Version 2.0.4 path configuration
export PATH="$HOME/opt/usr/local/bin/:$PATH"
# AWS CLI configuration
export PATH="/Users/sk/.local/bin:$PATH"
# cloud_sql_proxy (GCP)
export PATH="/Users/sk/:$PATH"
# pyenv
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"
alias pyenv="SDKROOT=$(xcrun --show-sdk-path) pyenv"
# auto start tmux
# if [ $SHLVL = 1 ]; then
# tmux
# fi
# llvm
export PATH="/usr/local/opt/llvm/bin:$PATH"
# The next line updates PATH for the Google Cloud SDK.
if [ -f "$HOME/google-cloud-sdk/path.zsh.inc" ]; then . "$HOME/google-cloud-sdk/path.zsh.inc"; fi
# The next line enables shell command completion for gcloud.
if [ -f "$HOME/google-cloud-sdk/completion.zsh.inc" ]; then . "$HOME/google-cloud-sdk/completion.zsh.inc"; fi
追記
❯ pyenv init -
export PATH="/Users/sk/.pyenv/shims:${PATH}"
export PYENV_SHELL=zsh
source '/usr/local/Cellar/pyenv/1.2.15/libexec/../completions/pyenv.zsh'
command pyenv rehash 2>/dev/null
pyenv() {
local command
command="${1:-}"
if [ "$#" -gt 0 ]; then
shift
fi
case "$command" in
rehash|shell)
eval "$(pyenv "sh-$command" "$@")";;
*)
command pyenv "$command" "$@";;
esac
}
~
❯ \pyenv init -
export PATH="/Users/sk/.pyenv/shims:${PATH}"
export PYENV_SHELL=zsh
source '/usr/local/Cellar/pyenv/1.2.15/libexec/../completions/pyenv.zsh'
command pyenv rehash 2>/dev/null
pyenv() {
local command
command="${1:-}"
if [ "$#" -gt 0 ]; then
shift
fi
case "$command" in
rehash|shell)
eval "$(pyenv "sh-$command" "$@")";;
*)
command pyenv "$command" "$@";;
esac
}
追記
再度、状況を検証したところ、ターミナルを起動した直後に source ~/.zshrc
を行ったときはエラーは出力されず、 exec $SHELL
後に source ~/.zshrc
を実行した際に上記エラーが出ることが判明しました。
原因をご存じの方、ご回答いただけるとありがたいです…