After installing oh-my-zsh: ... /.zshrc:source:34: no such file or directory ... /.oh-my-zsh/oh-my-zsh.sh

116,644

Solution 1

Installing zsh doesn't install Oh My Zsh, which might explain if you don't have an oh-my-zsh.sh file at all (this was the case for me).

You can install Oh My Zsh by running

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

Solution 2

For this:

/Users/jack/.zshrc:source:34: no such file or directory: /Users/jack/.oh-my-zsh/oh-my-zsh.sh

The problem is this line:

source $ZSH/oh-my-zsh.sh

You don't have a file called oh-my-zsh.sh in /Users/jack/.oh-my-zsh

For this:

/Users/jack/.zshrc:source:38: no such file or directory: .bashrc

The problem is the same as above; essentially, you don't have .bashrc file in /Users/jack/

Your $ZSH is pointing to /Users/jack/.oh-my-zsh and it looks like there's no such file in that directory with the name zsh.sh

As far as the initial problem (zsh: command not found: rvm) the issue is that the command rvm is not located anywhere in your $PATH which apparently points to /usr/local/bin plus whatever the system-wide setting is.

I recommend you use find / -name "rvm" and see where in the file system is rvm really located and then update your $PATH variable as so: export PATH=/path/to/rv/:$PATH

Solution 3

Quick fix to this issue

/Users/jack/.zshrc:source:34: no such file or directory: /Users/jack/.oh-my-zsh/oh-my-zsh.sh

Make the executable, executable.

cd .oh-my-zsh/ && chmod 744 oh-my-zsh.sh

Then run exec zsh to restart your shell. If you don't get the error, and your selected theme is working, you are good to go.

Solution 4

whenever I opened a new terminal window (iterm2) I encountered the same problem:

/Users/XXX/.zshrc:source:129: no such file or directory: /oh-my-zsh.sh

after running source .zshrc everything loaded fine though.

I did however have a oh-my-zsh.sh in my ~/.oh-my-zsh directory.

(it doesnt need to be altered with chmod +x or anything.)

I realised everything I was missing was the line ZSH=$HOME/.oh-my-zsh before the lines with

export ZSH="/Users/XXX/.oh-my-zsh" and source $ZSH/oh-my-zsh.sh

Solution 5

I removed my old .oh-my-zsh file which was located in home/username/.oh-my-zsh then installed it again by runnung sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" And the problem was solved.

Share:
116,644

Related videos on Youtube

keruilin
Author by

keruilin

Updated on September 18, 2022

Comments

  • keruilin
    keruilin over 1 year

    I just tried to install oh-my-zsh. I get the following error when I try to run rvm:

    zsh: command not found: rvm
    

    I also get the following error when I try to open a new tab:

    /Users/jack/.zshrc:source:34: no such file or directory: /Users/jack/.oh-my-zsh/oh-my-zsh.sh
    /Users/jack/.zshrc:source:38: no such file or directory: .bashrc
    

    Here's my .zshrc file:

    # Path to your oh-my-zsh configuration.
    ZSH=$HOME/.oh-my-zsh
    
    # Set name of the theme to load.
    # Look in ~/.oh-my-zsh/themes/
    # Optionally, if you set this to "random", it'll load a random theme each
    # time that oh-my-zsh is loaded.
    ZSH_THEME="robbyrussell"
    
    # Example aliases
    # alias zshconfig="mate ~/.zshrc"
    # alias ohmyzsh="mate ~/.oh-my-zsh"
    
    # Set to this to use case-sensitive completion
    # CASE_SENSITIVE="true"
    
    # Comment this out to disable weekly auto-update checks
    # DISABLE_AUTO_UPDATE="true"
    
    # Uncomment following line if you want to disable colors in ls
    # DISABLE_LS_COLORS="true"
    
    # Uncomment following line if you want to disable autosetting terminal title.
    # DISABLE_AUTO_TITLE="true"
    
    # Uncomment following line if you want red dots to be displayed while waiting for completion
    # COMPLETION_WAITING_DOTS="true"
    
    # Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)
    # Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
    # Example format: plugins=(rails git textmate ruby lighthouse)
    plugins=(git bundler brew gem rvm cscairns)
    
    source $ZSH/oh-my-zsh.sh
    
    # Customize to your needs...
    
    source .bashrc
    export PATH=/usr/local/bin:$PATH
    

    What do I need to do to fix these errors?

  • ZGski
    ZGski about 5 years
    Two weeks of issues with zsh came to an end with this one line. Thank you!