I wonder if this is all a PATH issue. I have MacBook Pro 12.6, with homebrew. No pyenv or virtualenv. (perhaps I should..) I am using nvim.
When I start iterm it launches python to the python command prompt rather than my zsh prompt. When I ctrl D it goes straight to the zshell prompt with no complaints.
Last login: Sun Oct 23 10:07:06 on ttys001
/etc/zshrc:7: command not found: locale
Python 3.9.6 (default, Sep 19 2022, 18:46:30)
[Clang 14.0.0 (clang-1400.0.29.201)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>
My /etc/paths is
/usr/local/bin
/usr/bin
/bin
/usr/sbin
/sbin
My .zshenv is
export PATH=/Users/np/.local/bin:$PATH
My .zsh_profile is
export PATH="$PATH:/usr/bin"
export PATH="$PATH:/usr/sbin"
export PATH=/usr/local/bin:/usr/local/sbin:$PATH
export PATH=/opt/homebrew/bin:$PATH
PATH=/.local/bin:$PATH
PATH=/bin:/usr/bin:/usr/local/bin:${PATH}
#clipboard
set clipboard=unnamed
#oh-my-zsh
export ZSH="$HOME/.oh-my-zsh"
source $ZSH/oh-my-zsh.sh
#Theme
ZSH_THEME="powerlevel10k/powerlevel10k"
#Plugins
plugins=(git zsh-autosuggestions z )
source $ZSH/oh-my-zsh.sh
#/opt/homebrew/etc/profile.d/z.sh
#aliases
source ~/.zsh_aliases
#P10k
# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
source /Users/np/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
export PATH="/opt/homebrew/bin:$PATH"
export PATH="/opt/homebrew/sbin:$PATH"```
I know the PATH entries are a mess.
I don't know how to fix the PATHS and dont have a clear idea of the priorities and orders for PATHS if indeed that is the issue. I know that my path to homebrew should be loaded first so that the system uses homebrew links before system links.
I think this is something to do with my multiple pythons and I need advice on wihich to delete, - presumably all except the homebrew and native mac ones as I mainly use homebrew.
Here is
Which -a python
/opt/homebrew/bin/python3
/usr/bin/python3
/usr/local/bin/python3
/opt/homebrew/bin/python3
/usr/local/bin/python3
/opt/homebrew/bin/python3
/Library/Frameworks/Python.framework/Versions/3.9/bin/python3
/usr/bin/python3
My suggestion is to start with an empty zshrc/zprofile and work back slowly from there. Add in a few lines at a time until you have what you want. Adding items one change at a time and testing is the best way to get out of this hole and find out where the included script is that is causing your issues. Once you add in a line that causes the python prompt to appear, you'll know where to dig in deeper.
This is not going to explicitly solve your issues, but I'd like to share a setup that has worked for me:
For myself, I've found a more manageable way to tame my zsh settings are to break it out into multiple files. In the
~/.zshrcand~/.zprofileI have a single line:If your zshrc and zprofile should be different, then create separate entrypoints, but do re-use common sources.
The contents of
~/zsetupis a git repo that I back in source control (with any secrets added to my.gitignore). I have configuration files and simple zsh sources modularized into small files specific to their purpose which are sourced fromzsetup/main. The git repo allows me to view audits of how I changed my settings over time and allows me to quickly get back up and running when I format my laptop or move to a new one.Example of
zsetup/mainis:Example for my
zsetup/pathlooks like:Some fun functions I have setup in
zsetup/aliases:Hope this helps you out!