I installed pyenv last night on my personal MacBook using brew and followed secondary install steps here:
https://github.com/pyenv/pyenv?tab=readme-ov-file#set-up-your-shell-environment-for-pyenv
despite having followed steps exactly I can only use pyenv python versions after running eval "$(pyenv init -)"
on every terminal startup. see below:
brandonfallings@Brandons-MBP ~ % which python3
/usr/bin/python3
brandonfallings@Brandons-MBP ~ % eval "$(pyenv init -)"
brandonfallings@Brandons-MBP ~ % which python3
/Users/brandonfallings/.pyenv/shims/python3
brandonfallings@Brandons-MBP ~ %
Notice how I need to run the eval "$(pyenv init -)"
for pyenv to manage my python versions.
Also, whenever I open a terminal window I get the following error:
/Users/brandonfallings/.zprofile:4: permission denied: /Users/brandonfallings/.zshrc
/Users/brandonfallings/.zprofile:5: permission denied: /Users/brandonfallings/.zshrc
/Users/brandonfallings/.zprofile:6: permission denied: /Users/brandonfallings/.zshrc
Restored session: Wed Aug 7 17:06:49 EDT 2024
/Users/brandonfallings/.zshrc:4: permission denied: /Users/brandonfallings/.zshrc
/Users/brandonfallings/.zshrc:5: permission denied: /Users/brandonfallings/.zshrc
/Users/brandonfallings/.zshrc:6: permission denied: /Users/brandonfallings/.zshrc
I’m assuming these two are related and zsh cant load .zshrc so cannot run the commands needed for pyenv. my ~/.zshrc looks like this:
export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || p$
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.zshrc
echo '[[ -d $PYENV_ROOT/bin ]] && export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.zs$
echo 'eval "$(pyenv init -)"' >> ~/.zshrc
I set up pyenv just fine on my work computer a few weeks ago without any problems using the same steps, so kind of at a loss
I tried changing permissions of my .zshrc but I also don’t have permissions to do that either:
brandonfallings@Brandons-MBP ~ % chmod +x ~/.zshrc
chmod: Unable to change file mode on /Users/brandonfallings/.zshrc: Operation not permitted