📚

Ubuntu20.04にHomebrewをインストールする方法

2022/11/23に公開

dbtユーザでHomebrewをインストール

rootユーザだとエラーになるので注意

dbt@dbt:~$ sudo apt install build-essential procps curl file git -y
dbt@dbt:~$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

PATHの追加

インストールログにWarningが出ておりどうやらPATH追加が必要みたいです。

warning
 Warning: /home/linuxbrew/.linuxbrew/bin is not in your PATH.
  Instructions on how to configure your shell for Homebrew
  can be found in the 'Next steps' section below.
Next stepsの内容
 ==> Next steps:
- Run these three commands in your terminal to add Homebrew to your PATH:
    echo '# Set PATH, MANPATH, etc., for Homebrew.' >> /home/dbt/.profile
    echo 'eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"' >> /home/dbt/.profile
    eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
- Install Homebrew's dependencies if you have sudo access:
    sudo apt-get install build-essential
PATHを追加していく
echo 'eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"' >> /home/dbt/.profile
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
sudo apt-get install build-essential
brew install gcc

確認

dbt@dbt:~$ brew --version
Homebrew 3.6.12
Homebrew/homebrew-core (git revision d52f2bad093; last commit 2022-11-23)
dbt@dbt:~$ 

virtualenvのインストール

dbt@dbt:~$ brew install virtualenv

Discussion