Reputation: 2017
Looks like I've messed up my terminal really badly.
Im trying simple commands like ls
, cd
but I get:
-bash: ls: command not found
No brew
commands are found either.
I have tried following Is there any way to reset Mac terminal environment to factory settings?
But I get the same same message that -bash: rm: command not found
I can't even open my profile_bash
file. Is there anyway to reset the terminal to factory settings. Nothing is working in terminal.
Upvotes: 3
Views: 34863
Reputation: 1
accessing the directory /Library/Preferencia/com.apple.Terminal.plist
let's change the initial shell of the terminal if it is zsh put csh which is the default shell then go to the terminal in the settings also change the initial shell by csh and restart the terminal . then you can change the shell to zsh and configure
Upvotes: 0
Reputation: 1395
Thanks folks for contributions. Just like @Yuri Ginsburg said. export PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:
.
The following are steps i used to fix back ZSH
terminal and to make sure all commands are working such as brew
, pwd
, ls
and more.
How I solved the issue and be able to run all commands again? I tried the following trick.
Open your terminal and type export PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:
Please don't close or restart the terminal cause it will fail again. Instead do the following.
Open your .zshrc
file like this open ~/.zshrc
and add the same command we used in step 1. After go to the opened text file and modify it accordingly.
# my configuration so yours might different. Try to comment most un trusted and un comment one at time.
export PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:
ZSH_THEME="robbyrussell"
export NVM_DIR="$HOME/.nvm"
[ -s "/opt/homebrew/opt/nvm/nvm.sh" ] && \. "/opt/homebrew/opt/nvm/nvm.sh" # This loads nvm
[ -s "/opt/homebrew/opt/nvm/etc/bash_completion.d/nvm" ] && \. "/opt/homebrew/opt/nvm/etc/bash_completion.d/nvm" # This loads nvm bash_completion
# PATH="/usr/local/opt/libpq/bin:$PATH"
# PATH="/Users/niyongabo/Library/Python/3.8/bin"
Notice that i did export the same command and commented other paths. The reason is that I don't know what's going so I rather un comment later when everything get back to normal
Save the file and go back to your terminal and write this command source ~/.zshrc
to load the changes to terminal.
I hope you can fix back the issue.
macOS Monterey
Upvotes: 1
Reputation: 31
Follow these steps to reset it:
mv .bashrc .bashrc.bak
redo the same thing for .bash_profile
Try recreating but files your renamed earlier by touch .bashrc
same for .bash_profile
.
Upvotes: 3