Linux(Ubuntu-20.04)環境にhomebrewをインストールする

Linux(Ubuntu-20.04)環境にhomebrewをインストールする

brewのインストール

Ubuntu-20.04(WSL)にhomebrewインストールしておきました。

注意:rootで実行すると「Don’t run this as root!」と表示されるのでrootでは実行してはいけません。

Linux(Ubuntu-20.04)環境にhomebrewをインストールする

コマンドは公式サイトからコピーしてください

Homebrew
The Missing Package Manager for macOS (or Linux).

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.
==> Installation successful!

Install成功しましたが、パス通ってないとの事で、Next Stepsに進みます。

==> Next steps:
– Run these two commands in your terminal to add Homebrew to your PATH:
echo ‘eval “$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)”‘ >> /home/takahashi-h5/.profile
eval “$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)”
– Install Homebrew’s dependencies if you have sudo access:
sudo apt install build-essential
For more information, see:
Documentation
Documentation for the missing package manager for macOS (or Linux).
/Homebrew-on-Linux
– We recommend that you install GCC:
brew install gcc
– Run brew help to get started
– Further documentation:
https://docs.brew.sh

書いてある通りのコマンドを実行します。

$ echo 'eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"' >> /home/takahashi-h5/.profile
↑各環境のホームディレクトリに変更してください
$ eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
$ sudo apt install build-essential
$ source .profile ※コイツ必要、または、再ログインが必要
$ brew install gcc

以上でhomebrewインストール完了です。

試しにbrewコマンドでgrpcurlをUbuntu-20.04(WSL)にインストールしてみます。

$ brew install grpcurl

コマンド実行してみます。

$ grpcurl -version
grpcurl 1.8.6

grpcurlが正常にインストールされています。

brewのアンインストール

brewのアンインストールを行います。

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh)"

.profileに1行追加した箇所をコメントアウトします。

eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
↓
#eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"

.profileを実行します。

$ source .profile

以上です。

brewのhelp

Documentation
Documentation for the missing package manager for macOS (or Linux).

grpcurl

GitHub - fullstorydev/grpcurl: Like cURL, but for gRPC: Command-line tool for interacting with gRPC servers
Like cURL, but for gRPC: Command-line tool for interacting with gRPC servers - GitHub - fullstorydev/grpcurl: Like cURL,...

コメント

タイトルとURLをコピーしました