brew的Brew安装?

Pat*_* Ma 21 homebrew zsh

嗨,我刚刚关注运行OSX Lion Server的Mac Mini Server的思想机器人笔记本电脑设置.我不确定一切都安装正确.请指教.

我没有~/.bash_profile,~/.bashrc但我确实有~/.profile

但是这里是.zshrc我使用的内容.zsh.

   1 # load our own completion functions
   2 fpath=(~/.zsh/completion $fpath)
   3 
   4 # completion
   5 autoload -U compinit
   6 compinit
   7 
   8 # automatically enter directories without cd
   9 setopt auto_cd
  10 
  11 # use vim as an editor
  12 export EDITOR=vim
  13 
  14 # aliases
  15 if [ -e "$HOME/.aliases" ]; then
  16   source "$HOME/.aliases"
  17 fi
  18 
  19 # vi mode
  20 bindkey -v
  21 bindkey "^F" vi-cmd-mode
  22 bindkey jj vi-cmd-mode
  23 
  24 # use incremental search
  25 bindkey "^R" history-incremental-search-backward
  26 
  27 # add some readline keys back
  28 bindkey "^A" beginning-of-line
  29 bindkey "^E" end-of-line
  30 
  31 # handy keybindings
  32 bindkey "^P" history-search-backward
  33 bindkey "^Y" accept-and-hold
  34 bindkey "^N" insert-last-word
  35 bindkey -s "^T" "^[Isudo ^[A" # "t" for "toughguy"
  36 
  37 # expand functions in the prompt
  38 setopt prompt_subst
  39 
  40 # prompt
  41 export PS1='[${SSH_CONNECTION+"%n@%m:"}%~] '
  42 
  43 # ignore duplicate history entries
  44 setopt histignoredups
  45 
  46 # keep TONS of history
  47 export HISTSIZE=4096
  48 
  49 # look for ey config in project dirs
  50 export EYRC=./.eyrc
  51 
  52 # automatically pushd
  53 setopt auto_pushd
  54 export dirstacksize=5
  55 
  56 # awesome cd movements from zshkit
  57 setopt AUTOCD
  58 setopt AUTOPUSHD PUSHDMINUS PUSHDSILENT PUSHDTOHOME
  59 setopt cdablevars
  60 
  61 # Try to correct command line spelling
  62 setopt CORRECT CORRECT_ALL
  63 
  64 # Enable extended globbing
  65 setopt EXTENDED_GLOB
  66 
  67 # RVM
  68 [[ -s '/Users/pma/.rvm/scripts/rvm' ]] && source '/Users/pma/.rvm/scripts/rvm'
Run Code Online (Sandbox Code Playgroud)

Brew向Brew医生抱怨

[~] brew doctor
/usr/bin is in your PATH before Homebrew's bin. This means that system-
provided programs will be used before Homebrew-provided ones. This is an
issue if you install, for instance, Python.

Consider editing your .bashrc to put:
  /usr/local/bin
ahead of /usr/bin in your $PATH.
Run Code Online (Sandbox Code Playgroud)

zsh的:

[~] zsh --version
zsh --version
zsh 4.3.11 (i386-apple-darwin11.0)
Run Code Online (Sandbox Code Playgroud)

那么我怎样才能确保正确安装brew并消除brew医生的错误?

Dev*_*n M 53

尝试在你的行中设置这一行 .zshrc

export PATH=/usr/local/bin:$PATH
Run Code Online (Sandbox Code Playgroud)


Luc*_*mie 15

这对我有用:

export PATH="/usr/local/bin:$PATH" >> ~/.zshrc
Run Code Online (Sandbox Code Playgroud)


Saj*_*mmi 15

这在 macOS ARM上对我有用:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Run Code Online (Sandbox Code Playgroud)

进而:

export PATH="/opt/homebrew/bin:$PATH" >> ~/.zshrc
Run Code Online (Sandbox Code Playgroud)

  • `echo 'export PATH="/opt/homebrew/bin:$PATH"' >> ~/.zshrc` (6认同)
  • 我确认这适用于 M1 Mac。*按照brew install*的建议,将同一行添加到“.zprofile”*没有*工作。 (4认同)

小智 12

不确定这是否晚了,但您可以简单地运行它以将 Homebrew 添加到您的PATH

eval $(/home/linuxbrew/.linuxbrew/bin/brew shellenv)
Run Code Online (Sandbox Code Playgroud)

  • 我将此行添加到我的“~/.zshrc”中,现在我每次都可以运行“brew”。 (4认同)

Vik*_*nth 9

遵循 @Sajjad 的回答确实有帮助,但每次启动一个新终端时我都必须运行该命令

export PATH="/opt/homebrew/bin:$PATH" >> ~/.zshrc
Run Code Online (Sandbox Code Playgroud)

我不太了解unix,但我相信这里发生的事情是我们正在将 export PATH="/opt/homebrew/bin:$PATH"部分附加到我们的.zshrc文件中,该部分位于文件末尾的文件结构的根部。

于是,我跑了

nano ~/.zshrc
Run Code Online (Sandbox Code Playgroud)

并添加了

export PATH="/opt/homebrew/bin:$PATH" 
Run Code Online (Sandbox Code Playgroud)

最后,从那时起它适用于所有终端。

如果相关的话我在 M1


shi*_*tel 7

打开文件中的 ~/.zshrc 文件第一行说

# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
Run Code Online (Sandbox Code Playgroud)

只需注释掉第二行它就会开始工作:)


小智 5

我使用ohmyzsh。进入目录

cd /usr/local/bin
brew doctor
Run Code Online (Sandbox Code Playgroud)

您会注意到它显示如下警告:

Warning: You have unlinked kegs in your Cellar
Leaving kegs unlinked can lead to build-trouble and cause brews that depend on
those kegs to fail to run properly once built. Run `brew link` on these:
autoconf
automake
gdbm
gnupg
libgpg-error
libksba
libtool
libyaml
mongodb
node
pcre
pkg-config
zsh
Run Code Online (Sandbox Code Playgroud)

您必须在此处运行命令:

brew link zsh
Run Code Online (Sandbox Code Playgroud)

并为我链接它。

  • `/home/linuxbrew/.linuxbrew/bin/brew doctor` 如果未定义brew命令并且您安装在那里 (2认同)

Amj*_*asi 5

通过以下命令安装 Homebrew 后

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Run Code Online (Sandbox Code Playgroud)

跑步

echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> /Users/atubasi/.zprofile
Run Code Online (Sandbox Code Playgroud)

然后运行

eval "$(/opt/homebrew/bin/brew shellenv)"
Run Code Online (Sandbox Code Playgroud)

这将评估您的 Homebrew 设置是否正常工作。您可以运行brew help以确保您的 zsh 配置文件中定义了brew。