28

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?

Pro Backup
  • 4,686
  • 12
  • 50
  • 82
keruilin
  • 381
  • 1
  • 3
  • 4

11 Answers11

25

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)"
Dávid Pásztor
  • 351
  • 3
  • 4
7

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

Icarus
  • 341
  • 1
  • 4
4

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.

Jrich
  • 41
  • 2
2

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

TTY
  • 21
  • 1
1

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.

0

I had the following error:

/Users/frankus/.zshrc:source:50: no such file or directory:  /Users/frankus/.oh-my-zsh^M/oh-my-zsh.sh

I fixed it by renaming the oh-my-zsh folder

mv ~/.oh-my-zsh^M ~/.oh-my-zsh
HalosGhost
  • 4,732
  • 10
  • 33
  • 41
Frank Fu
  • 101
  • 1
0

I also got this error and the error is occurring due to simple typo.

In your .zshrc file where you set the name of the theme don't include quotation marks. So instead of doing

ZSH_THEME="robbyrussell"

you should rdo the following

ZSH_THEME=robbyrussell

This will solve your problem of getting a error when opeing a new tabs. Thanks.

0

for me the issue turned out to be .zshrc file itself, as I've migrated to another machine and simply copied the complete file instead of changing value of ZSH which was set to ZSH=<old_machine_path>/.oh-my-zsh just changed it to newer machine s path and it worked.

parv
  • 1
0

if you are on MacOS and get an error similar to:

/Users/USERNAME/.zshrc:78: no such file or directory: ^[]7;file://WHATEVER/Users/USERNAME^G

make sure no quotation marks are around:

source $ZSH/oh-my-zsh.sh

in ~/.zshrc.

I had ` around it.

kn1g
  • 101
  • 1
0

Move source $ZSH/oh-my-zsh.sh after the PATH variable so it looks like below. Save and reopen Terminal.

export ZSH="/Users/<username>/.oh-my-zsh"
export PATH=$HOME/bin:/usr/local/bin:$ZSH:$PATH
source $ZSH/oh-my-zsh.sh
Allan
  • 1,010
  • 3
  • 15
  • 31
0

Put the below line to your ~/.zshrc file to fix the error with rvm

[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
Anthon
  • 78,313
  • 42
  • 165
  • 222