LoginSignup
9
6

More than 3 years have passed since last update.

macOSでの開発に欠かせないHomebrewパッケージマネージャー yumやapt-getのmac版?

Posted at

はじめに

CentOSではyum、Ubuntuではaptでアプリのパッケージ管理をしていると思います。macOSでもLinuxのようなコマンドや開発ツールを使うためにパッケージマネージャーがあります。

Homebrewというツールでyumやapt-getのように使う事ができます。

Homebrewとは

Rubyでできているパッケージ管理ソフトです。Ruby開発はもちろん、PythonやNode.jsもパッケージが用意されています。ホームページに用意されているパッケージの一覧があります。あまりやらないとは思いますが、macOSにnginxやmysqlのインストールも可能です。

Homebrewのインストール

環境

  • OS: macOS Catalina バージョン 10.15.4 |
  • Xcode: バージョン 11.4(11E146)

Xcodeのインストール

スクリーンショット 2020-04-11 10.07.53.png

Homebrewを使用するためにはmacOS標準のXcodeが必要です。

App Storeからダウンロードしてインストールしてください。1GB以上有るのでダウンロードにまあまあ時間かかります。

インストール後は一度アプリを起動して規約に同意する必要があります。

Homebrewのインストール

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

ターミナルを開いて下記のコマンドを入力します。

install.sh
Press RETURN to continue or any other key to abort
Password:

と聞かれるのでリターンキーを入力して、パスワードを入力。

install.sh
==> 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 (or will be during this `install` run).

==> Homebrew is run entirely by unpaid volunteers. Please consider donating:
  https://github.com/Homebrew/brew#donations

==> Next steps:
- Run `brew help` to get started
- Further documentation: 
    https://docs.brew.sh

Installation successful!と表示されたらインストール成功です。

Homebrewのコマンド

コマンド 機能
brew help ヘルプ表示
brew search [パッケージ名] パッケージを検索
brew info [パッケージ名] パッケージのバージョンなど情報表示
brew install [パッケージ名] パッケージのインストール
brew update パッケージ全体のアップデート
brew upgrade [パッケージ名] 指定パッケージのアップグレード
brew uninstall [パッケージ名] 指定パッケージのアンインストール
brew list インストールされているパッケージ表示

パッケージがあるかどうかをsearchで調べてinstallするのがよいと思います。

試しにHomebrewでインストールしてみる

ここではwegetをインストールしてみます。

% brew install wget

これでインストール完了です。

% wget https://google.com/

Homebrewで提供していないパッケージはコンパイルしてインストールという方法になります。

9
6
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
9
6