Mac Terminal重新启动后无法运行大多数命令 [英] Mac Terminal can't run most commands after restarting it

查看:290
本文介绍了Mac Terminal重新启动后无法运行大多数命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Mac.我有一个自定义的终端zsh,一段时间没问题.但是,当我重新启动计算机后,它的行为开始有所不同:

I am using a mac. I have a customised terminal zsh, and it was fine for a while. But after I restarted my computer, it started to behave differently:

  • 终端停止运行诸如rakerails的命令.
  • 我已经使用rails创建了应用程序,但是现在使用rails -v这样的rails命令可以使我做到这一点:

  • The terminal stopped running commands such as rake or rails.
  • I have already created applications using rails, but using a rails command like rails -v now gives me this:

Rails is not currently installed on this system. To get the latest version, simply type:

  • 用于显示波浪号~而不是我的用户名的终端,该终端也已停止.现在,它将显示完整的用户名:

  • The terminal used to display a tilde ~ instead of my username and that has also stopped. It now displays the full username:

    Gustaves-MacBook-Air% $ sudo gem install rails
    

  • 我什至不知道为什么它不起作用,以及为什么重启计算机会破坏它,即使我之前已经做过.

    I have no idea why it doesn't work, and why restarting the computer would break it, even though I've done it before.

    我什至无法重新下载rails:

    I can't even re-download rails:

    $ sudo gem install rails
    zsh: command not found: $
    

    因为我很早以前就已经在在线设置之后自定义了我的终端机.

    because I have customised my terminal long ago following an online setup.

    推荐答案

    这是我通过其他人的帮助解决此问题的方法:

    Here is how I fixed this problem, through other people's help:

    首先,我使用

    rm -rf ~/.oh-my-zsh
    rm ~/.zshrc
    

    然后我运行以下命令以重新下载zsh

    Then I ran the following command to re-download zsh

    sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
    

    最后,我用文本编辑器打开了隐藏的.zshrc文件,以添加我需要的插件

    Finally, I opened the hidden .zshrc file with text editor to add the plugins i needed

    plugins=(
      git
      bundler
      dotenv
      osx
      rake
      rbenv
      ruby
    )
    

    重启终端后,一切又恢复正常了

    After restarting the terminal, everything was working again

    这篇关于Mac Terminal重新启动后无法运行大多数命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆