➜ ~ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
-e:77: warning: Insecure world writable dir /usr/local/bin in PATH, mode 040677
It appears Homebrew is already installed. If your intent is to reinstall you
should do the following before running this installer again:
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"
The current contents of /usr/local are bin CODEOFCONDUCT.md etc git lib Library LICENSE.txt munki README.md sbin share .git .github .gitignore
➜ ~ brew install maven
zsh: command not found: brew
当前回答
如果您使用的是WSL2,请确保遵循linuxbrew的最终linux安装说明。
test -d ~/.linuxbrew && eval $(~/.linuxbrew/bin/brew shellenv)test -d /home/linuxbrew/.linuxbrew && eval $(/home/linuxbrew/.linuxbrew/bin/brew shellenv)
test -r ~/.bash_profile && echo "eval \$($(brew --prefix)/bin/brew shellenv)" >>~/.bash_profile
echo "eval \$($(brew --prefix)/bin/brew shellenv)" >>~/.profile
其他回答
您应该同时将/opt/homebrew/bin和/opt/homebrew/sbin添加到$PATH env中。
导出路径= / opt /组装/ bin: / opt /组装/ sbin: $路径
快捷方式:运行command
echo export PATH=$PATH:/opt/homebrew/bin:/opt/homebrew/sbin >> ~/.zshrc . sh
然后运行酿酒医生检查
只需在主目录中添加export PATH=/opt/homebrew/bin:$PATH即可
如果需要重新启动,或者重新打开终端
编辑.zshrc文件:
nano .zshrc
并在文件的开头添加以下内容:
export PATH=/opt/homebrew/bin:$PATH
保存并运行:
source ~/.zshrc
如果您使用的是WSL2,请确保遵循linuxbrew的最终linux安装说明。
test -d ~/.linuxbrew && eval $(~/.linuxbrew/bin/brew shellenv)test -d /home/linuxbrew/.linuxbrew && eval $(/home/linuxbrew/.linuxbrew/bin/brew shellenv)
test -r ~/.bash_profile && echo "eval \$($(brew --prefix)/bin/brew shellenv)" >>~/.bash_profile
echo "eval \$($(brew --prefix)/bin/brew shellenv)" >>~/.profile
我在macOS Big Sur(11.0.1)上遇到了类似的问题。在我的例子中,homebrew保存在/opt/homebrew/,而不是/usr/local/....
所以我补充道
导出路径= / opt /组装/ bin:美元的道路
到我的主目录中的.zshrc文件,并且ZSH shell能够找到brew命令。
推荐文章
- 在OSX中永久设置PATH环境变量
- 如何停止mysqld
- Git显示“警告:永久添加到已知主机列表”
- 如何从远程SSH会话发送数据到本地剪贴板
- Docker- compose无法连接到Docker Daemon
- SSH端口转发~/。ssh /配置文件?
- 如何复制文件跨计算机使用SSH和MAC OS X终端
- Mac SQLite编辑器
- 在MacOS X上推荐用什么方式安装Node.js、nvm和npm ?
- 如何在Swift中删除视图的所有子视图?
- 如何在Mac OS Lion上从命令行启动MySQL服务器?
- 警告用户/local/mysql/data目录不属于mysql用户
- 崇高的文本从命令行
- 在Mac OS X上使用鼠标聚焦(加上自动提升)
- 我在哪里可以找到Mac OS X Lion的“make”程序?