You can make a difference in the Apple Support Community!

When you sign up with your Apple Account, you can provide valuable feedback to other community members by upvoting helpful replies and User Tips.

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Converting .bash_profile to .zprofile caused "command not found" on almost all commands

Hi,


I really love my Mac. I love programming on my Mac. I love using VIM and BASH to program. I'm open to learning ZSH but it doesn't work for me.


After the Catalina 10.15.5 update, all my bash commands except ones like ls, cat, and mv, are not found. I couldn't open VIM. Even the command dirname didn't work. I read on Stack Overflow that I should rename my .bash_profile to .zprofile and my .bashrc to .zshrc so my bash configurations would get automatically loaded by ZSH. I changed my user account setting to use the /bin/zsh shell instead of bash shell like recommended. I was able to run VIM like desired, which allowed me to see what was in my .bash_profile before I moved it to .zprofile. But when I did the file move/rename explained previously and re-ran Terminal, it said command not found: dirname. Now, I can't open VIM, I can't run previous aliases, I can't even use the open command to open applications from the Terminal. It seems as though most commands I used in BASH no longer work.


Please help me figure out how to get back to the setup I was using before, with my BASH Profile and VIM.

MacBook Pro 13″, macOS 10.15

Posted on Jun 12, 2020 7:48 AM

Reply
Question marked as Top-ranking reply

Posted on Jun 12, 2020 10:26 AM

You need to update your PATH in zsh to search the paths where those programs are stored.

The bash_profile cannot be directly translated to zprofile. They are two different shells and have different configuration files, commands, etc.

The PATH and PROMPT syntax is different.


Here is a fairly comprehensive description of zsh: https://scriptingosx.com/2019/06/moving-to-zsh/

Similar questions

8 replies
Question marked as Top-ranking reply

Jun 12, 2020 10:26 AM in response to benjihansen

You need to update your PATH in zsh to search the paths where those programs are stored.

The bash_profile cannot be directly translated to zprofile. They are two different shells and have different configuration files, commands, etc.

The PATH and PROMPT syntax is different.


Here is a fairly comprehensive description of zsh: https://scriptingosx.com/2019/06/moving-to-zsh/

Jun 12, 2020 11:00 AM in response to benjihansen

Just because someone posts something on the Internet, does not mean they have actually tested what they posted. There are similarities, and dissimilarities between the Bash and Zsh dot file syntax. Your inability to find standard UNIX commands tells me that your current PATH setting is toast.


At your current shell prompt in the Terminal enter the following:


export PATH=".:$HOME:/usr/local/bin:$PATH


Then take what you want from my own .zshrc and add it to yours using vim.


# .zshrc
export PATH=".:$HOME/bin:/usr/local/bin:$PATH"
export MANPATH=".:/user/local/share/man:/usr/share/man:$MANPATH"
TPUT="/usr/bin/tput"
Bluebld="$(${TPUT} bold; ${TPUT} setaf 63)"
White="$(${TPUT} bold; ${TPUT} setaf 15)"
Green="$(${TPUT} bold; ${TPUT} setaf 42)"
Normal="$(${TPUT} sgr0)"
# don't want VPN DNS changing my hostname
MyHost="$(networksetup -getcomputername)"
export CLICOLOR=1
# [e]grep matches are quite yellow
export GREP_COLOR='00;38;5;226'
export GREP_OPTIONS='--color=auto --extended-regexp'
export LSCOLORS='gxfxcxdxbxegedabagacad'
export HOMEBREW_NO_ANALYTICS=1
PS1="%{${Green}%}${MyHost}: %~ %% %{${White}%}"
# command-line editing using vi/vim
bindkey -v
alias tt='open -a Textastic "$@"'



Converting .bash_profile to .zprofile caused "command not found" on almost all commands

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.