turingschool-examples / ruby-exercises

A collection of exercises to practice various aspects of Ruby
MIT License
237 stars 767 forks source link

Issue with `/opt/homebrew/bin/brew` and `/opt/homebrew/Cellar/rbenv...` in terminal #92

Open markcyen opened 3 years ago

markcyen commented 3 years ago

When I open up terminal, the following appears: /Users/markcyen/.zprofile:1: no such file or directory: /opt/homebrew/bin/brew (eval):source:3: no such file or directory: /opt/homebrew/Cellar/rbenv/1.1.2/libexec/../completions/rbenv.zsh

To fix /Users/markcyen/.zprofile:1: no such file or directory: /opt/homebrew/bin/brew, @redferret provided some guidance. In the terminal, type in atom .zprofile to open up the .zprofile in atom. What should be in there is eval $(/usr/local/bin/brew shellenv). Copy this and paste over what is already in there.

To fix (eval):source:3: no such file or directory: /opt/homebrew/Cellar/rbenv/1.1.2/libexec/../completions/rbenv.zsh, type in atom .zshrc in the terminal. .zshrc file should have some form of this text:

export PATH="/usr/local/bin:$PATH"
# Load version control information
autoload -Uz vcs_info
precmd() { vcs_info }
# Format the vcs_info_msg_0_ variable
zstyle ':vcs_info:git:*' formats '%b'
# Determine if current working directory is a git repository
git_branch_color() {
  if current_git_status=$(git status 2> /dev/null); then
    parse_git_dirty
  else
    echo ""
  fi
}
# Change branch color if working tree is clean
parse_git_dirty() {
  if current_git_status=$(git status | grep 'Changes to be committed:\|Untracked files:\|modified:|deleted:' 2> /dev/null); then
    echo "%F{red}"
  else
    echo "%F{green}"
  fi
}
# Set up the prompt (with git branch name)
setopt PROMPT_SUBST
PROMPT='%F{white}%d $(git_branch_color)${vcs_info_msg_0_} %f$  '
# rbenv
eval "$(rbenv init -)"