LoginSignup
75
94

More than 5 years have passed since last update.

Homebrewのインストールから操作まで

Last updated at Posted at 2018-12-24

お疲れ様です。Homebrew環境構築の項です。

ゴール

Homebrewを使えるようになる。

前提

  • Mac OS Mojave 10.14.2
  • 入門者として, DockerでなくHomebrewを使って行く
  • 簡単なコマンドライン操作が出来る

やること

  1. Homebrewとは
  2. Command Line Developer Toolsインストール
  3. Homebrewインストール
  4. Homebrewセットアップ
  5. Homebrew操作

1. Homebrewとは

homebrew-social-card.jpg

Homebrew(ホームブルー)は、macOSオペレーティングシステム上でソフトウェアの導入を単純化するパッケージ管理システムのひとつである。
(典拠:Wikipedia)

詳細資料 : homebrewとは何者か。仕組みについて調べてみた

2. Command Line Developer Toolsインストール

  • Homebrewのインストールに必要
  • Xcodeを最初からインストールする必要はない
    • XcodeはAppleの統合開発環境(IDE)
    • 容量が大きいため, Apple製品のアプリ開発をしなければ不要
terminal
$ xcode-select --install

実行後ダイアログ表示 -> [インストール]

3. Homebrewインストール

  • MacにはRubyが標準搭載されている
  • HomebrewはRubyで書かれているので実行できる
terminal
$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

4. Homebrewセットアップ

動作環境に異常がないか確認する。

terminal
$ brew doctor
Your system is ready to brew.

警告が表示されたら指示に従って解消する

参考:私の場合は2つの警告が表示された
Warning1
Warning: Unbrewed dylibs were found in /usr/local/lib.
If you didn't put them there on purpose they could cause problems when building Homebrew formulae, and may need to be deleted.

Unexpected dylibs:
  /usr/local/lib/libFB360-PluginShell-ambiX.dylib

$ rm /usr/local/lib/libFB360-PluginShell-ambiX.dylib

# ダイナミックライブラリを削除して解決
Warning2
Warning: Broken symlinks were found. Remove them with `brew prune`:
  /usr/local/share/man/man3/*

$ brew prune /usr/local/share/man/man3/*
Pruned 1 symbolic links and 3 directories from /usr/local

# デッドシンボリックリンクを削除して解決

5. Homebrew操作

バージョンを確認する。

terminal
$ brew --version
Homebrew 1.8.6-36-gf050e42
Homebrew/homebrew-core (git revision 167c; last commit 2018-12-23)

Homebrewを更新する。

terminal
$ brew update
Updated 1 tap (homebrew/core).
==> Updated Formulae ...

Homebrewが管理するパッケージを更新する。

terminal
$ brew upgrade            # パッケージ全部
$ brew upgrade パッケージ名 # パッケージ限定

古いバージョンを削除する。

terminal
$ brew cleanup
Removing: /Users/ユーザ名/Library/Caches/Homebrew/... (18.7KB)
==> This operation has freed approximately 18.7KB of disk space.

パッケージの一覧を表示する。

terminal
$ brew list
autoconf    pkg-config    openssl ...

情報を表示する。

terminal
$ brew info            # Homebrewの情報
$ brew info パッケージ名 # パッケージの情報

お疲れ様でした。
この項・完

75
94
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
75
94