当前位置: 首页>>技术教程>>正文


我可以在Ubuntu上使用Homebrew吗?

, ,

问题描述

我只是尝试使用Homebrew和Linuxbrew在Ubuntu Server上安装软件包,但是都失败了。这是我尝试安装它们的方式:

sudo apt-get install build-essential curl git m4 ruby texinfo libbz2-dev libcurl4-openssl-dev libexpat-dev libncurses-dev zlib1g-dev

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/linuxbrew/go/install)"

我收到以下警告:

Warning: /home/tong/.linuxbrew/bin is not in your PATH.

我在home /etc中运行我的bash.bashrc并添加以下内容:

export PATH="$HOME/.linuxbrew/bin:$PATH"
export MANPATH="$HOME/.linuxbrew/share/man:$MANPATH"
export INFOPATH="$HOME/.linuxbrew/share/info:$INFOPATH"

然后我尝试了brew doctor但得到了No command 'brew' found。如何在Ubuntu上使用Homebrew?

最佳回答

我只是尝试使用ruby命令安装它,但是以某种方式无法解决依赖关系,因此brew无法完全安装。但是,尝试通过克隆进行安装:

git clone https://github.com/Homebrew/linuxbrew.git ~/.linuxbrew

然后将以下内容添加到您的.bash_profile中:

export PATH="$HOME/.linuxbrew/bin:$PATH"
export MANPATH="$HOME/.linuxbrew/share/man:$MANPATH"
export INFOPATH="$HOME/.linuxbrew/share/info:$INFOPATH"

它应该工作..

次佳回答

截至2018年2月,在Ubuntu(mine is 17.10)计算机上安装brew的操作非常简单:

sudo apt install linuxbrew-wrapper

然后,在第一次执行brew(只需键入brew --help)时,将要求您提供两个安装选项:

me@computer:~/$ brew --help
==> Select the Linuxbrew installation directory
- Enter your password to install to /home/linuxbrew/.linuxbrew (recommended)
- Press Control-D to install to /home/me/.linuxbrew
- Press Control-C to cancel installation
[sudo] password for me:

对于建议的选项,请键入密码(如果当前用户在sudo组中),或者,如果您希望将所有依赖项安装在自己的主文件夹中,请点击Ctrl + D。请享用。

第三种回答

以下步骤对我有用:

  • 从github克隆它

    git clone https://github.com/Homebrew/linuxbrew.git ~/.linuxbrew
    
  • 使用vi ~/.bash_profile打开.bash_profile文件

  • 添加这些行

    export PATH="$HOME/.linuxbrew/bin:$PATH"
    export MANPATH="$HOME/.linuxbrew/share/man:$MANPATH"
    export INFOPATH="$HOME/.linuxbrew/share/info:$INFOPATH"
    
  • 然后在终端中输入以下行

    export PATH=$HOME/.linuxbrew/bin:$PATH
    hash -r
    

是的,它完成了。在您的终端中键入brew以检查其存在。

参考资料

本文由Ubuntu问答整理, 博文地址: https://ubuntuqa.com/article/7967.html,未经允许,请勿转载。