新手问题 关于.bash_profile, .bashrc, .zshrc, path 应该如何配置

banruosheng · 2013年01月26日 · 9762 次阅读

源于我在 zsh 里面:

jekyll -v
zsh:command not found

并且 ruby 版本也不对:

➜  ~  rvm ls
rvm rubies
=* ruby-1.9.3-p327 [ x86_64 ]
   ruby-1.9.3-p362 [ x86_64 ]

# => - current
# =* - current && default
#  * - default

➜  ~  ruby -v
ruby 1.9.3p362 (2012-12-25 revision 38607) [x86_64-darwin12.2.1]

应该是我的 path 有问题:

➜  ~  echo $PATH
/Users/black/.nvm/v0.8.18/bin:/usr/local/bin:/usr/local/sbin:~/bin:/usr/local/.rvm/scripts/rvm:/usr/local/mysql/bin:/opt/local/bin:/opt/local/sbin:/usr/local/sbin/:/usr/bin:/bin:/usr/sbin:/sbin:/usr/X11/bin:/usr/local/cuda/bin:/Users/black/.rvm/bin:/Users/black/usr/local/mysql/bin

有点凌乱,索性把配置文件都打印出来:

➜  ~  cat .bash_profile
export PATH="/usr/local/mysql/bin:$PATH"
export PATH="/usr/local/.rvm/scripts/rvm:$PATH"
export PATH="/usr/local/bin:/usr/local/sbin:~/bin:$PATH"
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function
➜  ~  cat .bashrc
PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting
PATH=$PATH:~/.rvm/bin
PATH=$PATH:~/usr/local/mysql/bin

# NVM
if [ -s ~/.nvm/nvm.sh ]; then
    NVM_DIR=~/.nvm
    source ~/.nvm/nvm.sh
fi
➜  ~  cat .zprofile

[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
➜  ~  cat .zshrc
# 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 bi-weekly auto-update checks
# DISABLE_AUTO_UPDATE="true"

# Uncomment to change how many often would you like to wait 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 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=(osx ruby mysql rails3 rails git textmate ruby rvm gem git github brew bundler textmate pow)
[[ -s $HOME/.rvm/scripts/rvm ]] && source $HOME/.rvm/scripts/rvm
source $ZSH/oh-my-zsh.sh

# Customize to your needs...

### brew doctor 也有问题

➜  ~  brew doctor
Warning: Some directories in your path end in a slash.
Directories in your path should not end in a slash. This can break other
doctor checks. The following directories should be edited:
    /usr/local/sbin/

可我就是没找到哪个配置文件里有这个 sbin/

是我哪里配置的不正确么?

暂无回复。
需要 登录 后方可回复, 如果你还没有账号请 注册新账号