はじめに
Ubuntu環境でHomebrewをインストールする方法を作成します。
環境
Ubuntu 22.04 LTS
Homebrewインストール
Homebrewのインストール手順は以下のようになります。
- コマンドを実行してHomebrewをインストール
- 追加コマンドを実行
- Homebrewの実行を確認
コマンドを実行してHomebrewをインストール
Homebrewの公式サイトにインストールのコマンドが書いています。
そのコマンドをターミナルで入力して実行します。
公式で書いているコマンドは以下のようになっています。
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
追加コマンドを実行
インストールが完了すると、以下のようなメッセージが表示されます。
「Next steps」の部分のコマンドを実行します。
{ユーザー名}
の部分には、自分のユーザー名が入っています。
==> Installation successful!
==> Homebrew has enabled anonymous aggregate formulae and cask analytics.
Read the analytics documentation (and how to opt-out) here:
https://docs.brew.sh/Analytics
No analytics data has been sent yet (nor will any be during this install run).
==> Homebrew is run entirely by unpaid volunteers. Please consider donating:
https://github.com/Homebrew/brew#donations
==> Next steps:
- Run these two commands in your terminal to add Homebrew to your PATH:
(echo; echo 'eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"') >> /home/{ユーザー名}/.bashrc
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
- Install Homebrew's dependencies if you have sudo access:
sudo apt-get install build-essential
For more information, see:
https://docs.brew.sh/Homebrew-on-Linux
- We recommend that you install GCC:
brew install gcc
- Run brew help to get started
- Further documentation:
https://docs.brew.sh
Homebrewの実行を確認
Homebrewが実行できるか確認します。
$ brew --version
Homebrew 4.3.5