zsh에서 찾을 수없는 명령
zsh
기본 bash 대신 z Shell ( )을 사용하고 있는데 문제가 발생하여 이전에 사용하던 모든 명령이 더 이상 인식되지 않습니다.
ls
zsh: command not found: ls
open -e .zshrc
zsh: correct 'open' to '_open' [nyae]?
재설정 방법이나이 zsh
문제를 해결하는 방법을 모릅니다 . $PATH
변수 의 내용은 다음과 같습니다 .
echo $PATH
/Users/Malloc/bin/Sencha/Cmd/3.1.2.342:/usr/local/bin/mate
.bash_profile
파일이나 .zshrc
파일을 열 수 없습니다 . 유일한 해결책은 zsh
. 어떤 아이디어?
편집하다:
이 스레드에zsh
표시된대로 재설정하려고 시도 했지만 항상 오류 가 발생했습니다.command not found
exec zsh
zsh: command not found: zsh
그래서 무슨 일이야? 모든 명령이 손실되는 이유는 무엇입니까?
PATH
변수 를 엉망으로 만들었 음이 분명 합니다. (현재 PATH
는 일반적인 유틸리티가있는 위치를 포함하지 않습니다.)
시험:
PATH=/bin:/usr/bin:/usr/local/bin:${PATH}
export PATH
또는 zsh를 "재설정"하려면 셸의 전체 경로를 지정합니다.
exec /bin/zsh
또는
exec /usr/bin/zsh
Sublime 텍스트와 같은 좋은 텍스트 편집기를 사용하여
.zshrc
파일을 엽니 다 (홈 디렉토리에 있어야 합니다. 파일이 보이지 않으면 열 때 파일 폴더를 마우스 오른쪽 버튼으로 클릭하고 '숨김 파일 표시'옵션을 선택하십시오). .그것이 말하는 곳을 찾으십시오.
export PATH=a-bunch-of-paths-separated-by-colons:
줄 끝, 끝 인용문 앞에 다음을 삽입하십시오.
:$HOME/.local/bin
그리고 그것은 당신을 위해 작동합니다.
먼저 터미널에 다음을 입력하여 이것이 작동하는지 테스트 할 수 있습니다. export PATH=$HOME/.local/bin:$PATH
이것을 터미널에 입력 한 후 오류가 사라지고 터미널이 정상적으로 작동하면 위의 해결 방법이 작동합니다. 그렇지 않은 경우 참조 오류가있는 폴더 (찾을 수없는 항목)를 찾아 위의 PATH를 PATH-TO-THAT-FOLDER로 대체해야합니다.
/ usr / local / bin /에 심볼릭 링크를 만들 수 있습니다.
sudo ln -s $HOME/.composer/vendor/bin/homestead /usr/local/bin/homestead
~ / .zsh 구성 파일에 별칭이 포함 된 bash 경로 파일의 경로를 포함합니다. 제 경우에는 ~ / .zsh 안에 "source ~ / .bash_profile"줄이 포함되어있었습니다.
나를 위해 터미널을 다시 시작하면 문제가 해결되는 것 같습니다.
저를 좋아한다면 두 개의 터미널 앱이있을 것입니다. 하나는 기본 셸로 bash를 사용하는 기본 터미널이고 다른 하나는 zsh를 셸로 사용하는 iTerm 2입니다. bash의 iTerm 2에서 명령과 zsh를 모두 사용하려면 다음을 수행해야합니다.
iTerm 2에서 기본 설정 (또는 command,)으로 이동합니다. 그런 다음 프로필 탭으로 이동하여 명령으로 이동합니다 . 아래 그림에서 볼 수 있듯이 명령 옵션 을 선택 하고 zsh 셸의 경로를 붙여 넣어야합니다 (경로를 찾으려면 할 수 있습니다 which zsh
).
At this point you will have the zsh as your default shell ONLY for iTerm 2 and you will have bash as the global default shell on default mac terminal app. Next, we are still missing the commands from bash in zsh. So to do this, you need to go on your bash (where you have your commands working) and get the PATH variable from env (use this command to do that: env | grep PATH
).
Once you have that, go to your iTerm 2 and paste your path on "send text at start" option.
export PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin && clear
Just reopen iTerm 2 and we are done!
I fixed the issue by opening the terminal preference general tab and changing the Command (complete path) to /bin/bash
to default and then editing the ~/.zshrc
file.
export PATH="all your path inside the quotes"
...without any whitespace between the PATH="
and save the file.
After saving the file, change the /bin/zsh
in your command or select default
...and restart terminal and you should have your zsh shell working again!
Restarting the terminal also made the trick for me.
As others have said, simply restarting the terminal after you've made changes should reset and changes you've made to your ~/.zshrc file. For instance after adding function to open visual studio:
function code {
if [[ $# = 0 ]]
then
open -a "Visual Studio Code"
else
local argPath="$1"
[[ $1 = /* ]] && argPath="$1" || argPath="$PWD/${1#./}"
open -a "Visual Studio Code" "$argPath"
fi
}
I was able to use the keyword code to open the program from the command line.
A way to edit the .zshrc file without doing it through iTerm2 or native Terminal on macOS is to use a terminal in another application. For example, I used the terminal as part of VSCode and was able to find and edit the file.
In my case, it was by mistake the commented code was uncommented at the very first line.
# If you come from bash you might have to change your $PATH.
해시가 제거되었습니다. 다시 추가하면 잘 작동했습니다.
누군가가 도움이 될 수 있도록 여기에 게시했습니다. 줄의 시작일 뿐이며 내가 한 것처럼 실수로 삭제 될 수 있기 때문입니다. 그리고 여러 가지 방법을 시도한 후에도 해결책이없는 것 같습니다.
zsh를 제거하고 다시 설치하십시오.
sudo yum remove zsh
sudo yum install -y zsh
참고 URL : https://stackoverflow.com/questions/18428374/commands-not-found-on-zsh
'code' 카테고리의 다른 글
Xcode 4-내가 삭제 한 키 체인 인증서를 다시 설치합니다. (0) | 2020.09.16 |
---|---|
Apache가 심볼릭 링크를 따르지 않음 (403 금지됨) (0) | 2020.09.16 |
jQuery를 사용하여 DIV에서 높이 스타일을 제거하려면 어떻게해야합니까? (0) | 2020.09.16 |
첫 번째 자식으로 요소를 삽입하는 방법은 무엇입니까? (0) | 2020.09.16 |
git push heroku master Permission denied (publickey). (0) | 2020.09.16 |