带有OhMyZSH警告的RVM,PATH设置不正确

时间:2016-08-19 15:19:03

标签: ruby oh-my-zsh zshrc

我刚安装了RVM的新副本,在运行rvm gemset list时,我一直收到此错误:

$ rvm gemset list
Warning! PATH is not properly set up, '/Users/dmonsewicz/.rvm/gems/ruby-2.3.1/bin' is not available,
         usually this is caused by shell initialization files - check them for 'PATH=...' entries,
         it might also help to re-add RVM to your dotfiles: 'rvm get stable --auto-dotfiles',
         to fix temporarily in this shell session run: 'rvm use ruby-2.3.1'.

gemsets for ruby-2.3.1 (found in /Users/dmonsewicz/.rvm/gems/ruby-2.3.1)
=> (default)
   *

这是我的.zshrc文件:

export HOME=/Users/dmonsewicz

# 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="ys"

# Example aliases
# alias zshconfig="mate ~/.zshrc"
# alias ohmyzsh="mate ~/.oh-my-zsh"

# Set to this to use case-sensitive completion
# CASE_SENSITIVE="true"

# Uncomment this to disable bi-weekly auto-update checks
# DISABLE_AUTO_UPDATE="true"

# Uncomment to change how often before auto-updates occur? (in days)
# export UPDATE_ZSH_DAYS=13

# 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 to disable command autocorrection
# DISABLE_CORRECTION="true"

# Uncomment following line if you want red dots to be displayed while waiting for completion
# COMPLETION_WAITING_DOTS="true"

# Uncomment following line if you want to disable marking untracked files under
# VCS as dirty. This makes repository status check for large repositories much,
# much faster.
# DISABLE_UNTRACKED_FILES_DIRTY="true"

# Uncomment following line if you want to  shown in the command execution time stamp
# in the history command output. The optional three formats: "mm/dd/yyyy"|"dd.mm.yyyy"|
# yyyy-mm-dd
# HIST_STAMPS="mm/dd/yyyy"

# 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)

source $ZSH/oh-my-zsh.sh

# User configuration

export PATH="/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin"

# # Preferred editor for local and remote sessions
# if [[ -n $SSH_CONNECTION ]]; then
#   export EDITOR='vim'
# else
#   export EDITOR='mvim'
# fi

# Compilation flags
# export ARCHFLAGS="-arch x86_64"

# ssh
# export SSH_KEY_PATH="~/.ssh/dsa_id"

PATH=$PATH:/usr/local/bin:/usr/local/sbin:$PATH
export LOCALEMMA_EMMA_BASE_DIR=/Users/dmonsewicz/dev/emma/
export LOCALEMMA_EMMADMIN_BASE_DIR=/Users/dmonsewicz/dev/emmadmin/
export LOCALEMMA_AUDIENCE_BASE_DIR=/Users/dmonsewicz/dev/audience/
export WORKON_HOME=$HOME/.virtualenvs

export PERL5LIB=$HOME/perl5/lib/perl5;
PATH=$HOME/perl5/bin:$PATH

PERL_MB_OPT="--install_base \"/Users/dmonsewicz/perl5\""; export PERL_MB_OPT;
PERL_MM_OPT="INSTALL_BASE=/Users/dmonsewicz/perl5"; export PERL_MM_OPT;

ORIGINAL_PATH=$PATH

function build_path {
    PATH=$(node bin):$ORIGINAL_PATH
}

PROMPT_COMMAND=build_path

export NVM_DIR="/Users/dmonsewicz/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"  # This loads nvm

# LOCALEMMA lemma zsh completion
fpath=(/Users/dmonsewicz/dev/LocalEmma/bin $fpath)
autoload -U compinit
compinit

eval $(dinghy shellinit)
export RAILS_ENV="development"
export DB_NAME="traverse_core_development"
export DB_USER="dmonsewicz"
export DB_PASSWORD=""

PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting

export PATH

source /usr/local/bin/virtualenvwrapper.sh

[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"

1 个答案:

答案 0 :(得分:-1)

将您的终端用作登录shell(如果您使用的是zsh /usr/bin/zsh --login)并尝试将以下行添加到~/.zshrc文件并将其source ~/.zshrc

export PATH="$PATH:$HOME/.rvm/bin" 
source ~/.rvm/scripts/rvm

然后使用像rvm use 2.3.0这样的rvm命令。 login shell允许你的rvm脚本更改系统的配置文件..比如将rvm ruby​​路径附加到$PATH变量