UJP - 技術情報2 : HomeBrewでよく使うコマンド HomeBrew/common

Life is fun and easy!

不正IP報告数

Okan Sensor
 
メイン
ログイン
ブログ カテゴリ一覧

Page Top

ヘルプの表示 anchor.png

 パラメータを入れずにbrewを実行すると,簡易ヘルプが表示される.  

mba13:~ ujpadmin$ brew
Example usage:
  brew [info | home | options ] [FORMULA...]
  brew install FORMULA...
  brew uninstall FORMULA...
  brew search [foo]
  brew list [FORMULA...]
  brew update
  brew upgrade [FORMULA...]
  brew pin/unpin [FORMULA...]
Troubleshooting:
  brew doctor
  brew install -vd FORMULA
  brew [--env | config]
Brewing:
  brew create [URL [--no-fetch]]
  brew edit [FORMULA...]
  https://github.com/Homebrew/brew/blob/master/share/doc/homebrew/Formula-Cookbook.md
Further help:
  man brew
  brew home
mba13:~ ujpadmin$
  
Page Top

brew listでインストールされているパッケージを探す anchor.png

 mba13:~ ujpadmin$ brew list
 atk			harfbuzz		pkg-config
 cairo			hicolor-icon-theme	py2cairo
 fontconfig		icu4c			pygobject
 freetype		jpeg			pygtk
 gdbm			libffi			python
 gdk-pixbuf		libpng			readline
 gettext			libtiff			rlwrap
 glib			openssl			sqlite
 gobject-introspection	pango
 gtk+			pixman
 mba13:~ ujpadmin$
Page Top

brew searchでパッケージを探す anchor.png

 apacheを探してみた.

mba13:~ ujpadmin$ brew search apache
apache-activemq            apache-drill               apache-forrest             apache-spark
apache-archiva             apache-fop                 apache-opennlp             apachetop
homebrew/versions/apache-spark141                     Caskroom/cask/apache-couchdb
homebrew/versions/apache-spark15                      Caskroom/cask/apache-directory-studio
mba13:~ ujpadmin$
Page Top

brew updateでパッケージ一覧の更新 anchor.png

mba13:~ ujpadmin$ brew update
Updated Homebrew from 7771f3a to f016a21.
Updated 1 tap (homebrew/core).
 ==> Updated Formulae
 argon2                     fetch-crl                  openshift-cli
 awscli                     glide                      signing-party
 certstrap                  lastpass-cli               sourcekitten
 cfr-decompiler             libsodium                  youtube-dl
 docker-cloud               macvim                     znapzend
 etl                        node                       zsh-syntax-highlighting
 ==> Deleted Formulae
 cowpatty

 これは実行したタイミングで表示される内容が異なる.1時間違っただけでも違うものが表示されるので注意.

Page Top

brew upgradeで更新のあるパッケージをビルドする anchor.png

 upgradeコマンドを実行し,その後updateコマンドでパッケージの更新がないか確認する.

mba13:~ ujpadmin$ brew upgrade
mba13:~ ujpadmin$ brew update
Already up-to-date.
mba13:~ ujpadmin$
Page Top

brew installでwgetコマンドをインストールしてみる anchor.png

 まずは,パッケージを探す.

mba13:~ ujpadmin$ brew search wget
wget                                     wgetpaste
mba13:~ ujpadmin$

 インストールしてみる.

mba13:~ ujpadmin$ brew install wget
==> Installing dependencies for wget: openssl
==> Installing wget dependency: openssl
==> Downloading https://homebrew.bintray.com/bottles/openssl-1.0.2g.el_capitan.bottle.tar.gz
######################################################################## 100.0%
==> Pouring openssl-1.0.2g.el_capitan.bottle.tar.gz
==> Caveats
A CA file has been bootstrapped using certificates from the system
keychain. To add additional certificates, place .pem files in
  /usr/local/etc/openssl/certs
and run
  /usr/local/opt/openssl/bin/c_rehash
This formula is keg-only, which means it was not symlinked into /usr/local.
Apple has deprecated use of OpenSSL in favor of its own TLS and crypto libraries
Generally there are no consequences of this for you. If you build your
own software and it requires this formula, you'll need to add to your
build variables:
    LDFLAGS:  -L/usr/local/opt/openssl/lib
    CPPFLAGS: -I/usr/local/opt/openssl/include
==> Summary
🍺  /usr/local/Cellar/openssl/1.0.2g: 1,678 files, 12.0M
==> Installing wget
==> Downloading https://homebrew.bintray.com/bottles/wget-1.17.1.el_capitan.bottle.1.tar.gz
######################################################################## 100.0%
==> Pouring wget-1.17.1.el_capitan.bottle.1.tar.gz
🍺  /usr/local/Cellar/wget/1.17.1: 9 files, 1.5M
mba13:~ ujpadmin $

 wgetに必要な依存関係のあるライブラリもインストールされている.最初このビールのアイコンは文字化けか何かかと思っていたけれど,よく考えればHomebrewはMacOS X限定なので絵文字も可能ということか.

 インストールされたかリストを確認.

mba13:~ ujpadmin$ brew list
atk			harfbuzz		pkg-config
cairo			hicolor-icon-theme	py2cairo
fontconfig		icu4c			pygobject
freetype		jpeg			pygtk
gdbm			libffi			python
gdk-pixbuf		libpng			readline
gettext			libtiff			rlwrap
glib			openssl			sqlite
gobject-introspection	pango			wget
gtk+			pixman
mba13:~ ujpadmin$

 wgetコマンドの詳細を確認.

mba13:~ ujpadmin$ brew list wget
/usr/local/Cellar/wget/1.17.1/bin/wget
/usr/local/Cellar/wget/1.17.1/share/info/wget.info
/usr/local/Cellar/wget/1.17.1/share/man/man1/wget.1
mba13:~ ujpadmin$

 実際にファイルが入っているか確認.

mba13:~ ujpadmin$ ls -la /usr/local/Cellar/wget/1.17.1/bin/wget
-r-xr-xr-x  1 ujpadmin  admin  480092  4  7 11:34 /usr/local/Cellar/wget/1.17.1/bin/wget
mba13:~ ujpadmin$

 wgetコマンドを実行しバージョンを表示させ,動作するか確認してみる.

mba13:~ ujpadmin$ /usr/local/Cellar/wget/1.17.1/bin/wget -V
GNU Wget 1.17.1 built on darwin14.5.0.
+digest -gpgme +https +ipv6 -iri +large-file -metalink -nls +ntlm
+opie -psl +ssl/openssl
Wgetrc:
    /usr/local/etc/wgetrc (system)
Compile:
    clang -DHAVE_CONFIG_H -DSYSTEM_WGETRC="/usr/local/etc/wgetrc"
    -DLOCALEDIR="/usr/local/Cellar/wget/1.17.1/share/locale" -I.
    -I../lib -I../lib -I/usr/local/opt/openssl/include -DNDEBUG
Link:
    clang -DNDEBUG -L/usr/local/opt/openssl/lib -lssl -lcrypto -ldl -lz
    ftp-opie.o openssl.o http-ntlm.o ../lib/libgnu.a
Copyright (C) 2015 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
<http://www.gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Originally written by Hrvoje Niksic <hniksic@xemacs.org>.
Please send bug reports and questions to <bug-wget@gnu.org>.
mba13:~ ujpadmin$ 

 

Page Top

brew removeでパッケージをアンインストールしてみる anchor.png

mba13:~ ujpadmin$ brew remove wget
Uninstalling /usr/local/Cellar/wget/1.17.1... (9 files, 1.5M)
mba13:~ ujpadmin$

 9ファイルが削除されたようだ.インストールした時は3つだったような気がするが? listコマンドで,パッケージが削除された事を確認する.

mba13:~ ujpadmin$ brew list
atk			harfbuzz		pkg-config
cairo			hicolor-icon-theme	py2cairo
fontconfig		icu4c			pygobject
freetype		jpeg			pygtk
gdbm			libffi			python
gdk-pixbuf		libpng			readline
gettext			libtiff			rlwrap
glib			openssl			sqlite
gobject-introspection	pango
gtk+			pixman
mba13:~ ujpadmin$

 存在してないことが確認できた.再度brewに問題がない事をdoctorで確認.パッケージをインストールして削除した後に異常が発生していないか確認する.

mba13:~ ujpadmin$ brew doctor
Your system is ready to brew.
mba13:~ ujpadmin$
Page Top

brew infoでインストールされているパッケージの容量やファイル数を確認する anchor.png

mba13:~ ujpadmin$ brew info
28 kegs, 14,503 files, 322.2M
mba13:~ ujpadmin$

 試しに,再度wgetをインストールして,wgetを削除してみる.

mba13:~ ujpadmin$ brew install wget
==> Downloading https://homebrew.bintray.com/bottles/wget-1.17.1.yosemite.bottle
Already downloaded: /Library/Caches/Homebrew/wget-1.17.1.yosemite.bottle.1.tar.gz
==> Pouring wget-1.17.1.yosemite.bottle.1.tar.gz
🍺  /usr/local/Cellar/wget/1.17.1: 9 files, 1.5M
mba13:~ ujpadmin$

 先ほど一度ダウンロードしているので,キャッシュから入手した模様.9個のファイルが増えている.

mba13:~ ujpadmin$ brew info
29 kegs, 14,512 files, 323.8M
mba13:~ ujpadmin$

 brew infoの情報でも増えている.インストール前は14,503 filesだった.  削除してinfoを確認してみる.

mba13:~ ujpadmin$ brew remove wget
Uninstalling /usr/local/Cellar/wget/1.17.1... (9 files, 1.5M)
mba13:~ ujpadmin$
mba13:~ ujpadmin$ brew info
28 kegs, 14,503 files, 322.2M
mba13:~ ujpadmin$

 一致している事が確認できた.

Page Top

brew install -vdオプションで詳細を表示しながらインストール anchor.png

 installの際に-vdオプションをつけて実行するとインストールの詳細が表示されながらのインストールとなる.どこに何のファイルが配置されたか確認できる.

mba13:~ ujpadmin$ brew install -vd wget
/usr/local/Library/brew.rb (Formulary::FormulaLoader):loading /usr/local/Library/Taps/homebrew/homebrew-core/Formula/wget.rb
/usr/local/Library/brew.rb (Formulary::FormulaLoader): loading /usr/local/Library/Taps/homebrew/homebrew-core/Formula/xz.rb
/usr/local/Library/brew.rb (Formulary::FormulaLoader): loading /usr/local/Library/Taps/homebrew/homebrew-core/Formula/pkg-config.rb
/usr/local/Library/brew.rb (Formulary::FormulaLoader): loading /usr/local/Library/Taps/homebrew/homebrew-core/Formula/openssl.rb
/usr/local/Library/brew.rb (Formulary::FormulaLoader): loading /usr/local/Library/Taps/homebrew/homebrew-core/Formula/makedepend.rb
/usr/local/Library/brew.rb (Formulary::FormulaLoader): loading /usr/local/Library/Taps/homebrew/homebrew-core/Formula/cctools.rb
==> Downloading https://homebrew.bintray.com/bottles/wget-1.17.1.yosemite.bottle.1.tar.gz
Already downloaded: /Library/Caches/Homebrew/wget-1.17.1.yosemite.bottle.1.tar.gz
==> Verifying wget-1.17.1.yosemite.bottle.1.tar.gz checksum
==> Pouring wget-1.17.1.yosemite.bottle.1.tar.gz
tar xvf /Library/Caches/Homebrew/wget-1.17.1.yosemite.bottle.1.tar.gz
x wget/1.17.1/
x wget/1.17.1/.bottle/
x wget/1.17.1/AUTHORS
x wget/1.17.1/bin/
x wget/1.17.1/ChangeLog
x wget/1.17.1/COPYING
x wget/1.17.1/INSTALL_RECEIPT.json
x wget/1.17.1/NEWS
x wget/1.17.1/README
x wget/1.17.1/share/
x wget/1.17.1/share/info/
x wget/1.17.1/share/man/
x wget/1.17.1/share/man/man1/
x wget/1.17.1/share/man/man1/wget.1
x wget/1.17.1/share/info/wget.info
x wget/1.17.1/bin/wget
x wget/1.17.1/.bottle/etc/
x wget/1.17.1/.bottle/etc/wgetrc
Changing install name in /usr/local/Cellar/wget/1.17.1/bin/wget
  from @@HOMEBREW_PREFIX@@/opt/openssl/lib/libssl.1.0.0.dylib
    to /usr/local/opt/openssl/lib/libssl.1.0.0.dylib
Changing install name in /usr/local/Cellar/wget/1.17.1/bin/wget
  from @@HOMEBREW_PREFIX@@/opt/openssl/lib/libcrypto.1.0.0.dylib
    to /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib
==> Finishing up
ln -s ../Cellar/wget/1.17.1/bin/wget wget
ln -s ../../Cellar/wget/1.17.1/share/info/wget.info wget.info
info /usr/local/share/info/wget.info
ln -s ../../../Cellar/wget/1.17.1/share/man/man1/wget.1 wget.1
==> Summary
🍺  /usr/local/Cellar/wget/1.17.1: 9 files, 1.5M
mba13:~ ujpadmin$

 どのファイルがどこに配置されたかよく分かる.

Page Top

公式サイト表示コマンド anchor.png

 公式サイトがデフォルトブラウザ上で表示される.

mba13:~ ujpadmin$ brew home
mba13:~ ujpadmin$
Page Top

homebrew-caskを使ってデスクトップアプリのパッケージ管理を行う anchor.png

 homebrew-caskによって,デスクトップアプリのインストールを行う事ができる.  まずは,searchコマンドで,対象となっているアプリケーションのリストを取得する.

mba13:~ ujpadmin$ brew cask search
==> Tapping caskroom/cask
Cloning into '/usr/local/Library/Taps/caskroom/homebrew-cask'...
remote: Counting objects: 3557, done.
remote: Compressing objects: 100% (3501/3501), done.
remote: Total 3557 (delta 57), reused 757 (delta 34), pack-reused 0
Receiving objects: 100% (3557/3557), 5.92 MiB | 624.00 KiB/s, done.
Resolving deltas: 100% (57/57), done.
Checking connectivity... done.
Tapped 1 formula (3,525 files, 13.6M)
==> Partial matches
010-editor
0ad
0xed
115browser
1clipboard
1password
33-rpm
4k-video-downloader
4k-youtube-to-mp3
4peaks
5iler

〜略〜

zipeg
zoc
zoho-docs
zoom
zoomus
zooom
zotero
zterm
zulip
zulu
mba13:~ ujpadmin$

 どのようなものがあるか調べてみたいが,いくつあるのかまず調べる.  

mba13:~ ujpadmin$ date;brew cask search|wc -l
2016年 4月 7日 木曜日 13時22分08秒 JST
    3058
mba13:~ ujpadmin$

 3058とは...MacPortsよりは少ないんかもしれないけれど.  Googleのモジュールだけでもたくさんある.

mba13:~ ujpadmin$ brew cask search|grep google
google-adwords-editor
google-chrome
google-cloud-sdk
google-drive
google-earth
google-earth-pro
google-earth-web-plugin
google-hangouts
google-japanese-ime
google-nik-collection
google-notifier
google-photos-backup
google-play-music-desktop-player
google-plus-auto-backup
google-refine
google-web-designer
googleappengine
mba13:~ ujpadmin$

 ここでは,Google Chromeをインストールしてみる.

Page Top

homebrew-caskでGoogle Chromeをインストールする. anchor.png

mba13:~ ujpadmin$ brew cask install google-chrome
==> We need to make Caskroom for the first time at /opt/homebrew-cask/Caskroom
==> We'll set permissions properly so we won't need sudo in the future
Password:

 初めての実行なので,sudoでパスワードを入力する必要が有ると表示されているので,その通りログインしている自分のIDのパスワードを入力する.  

=> Caveats
The Mac App Store version of 1Password won't work with a Homebrew-Cask-linked Google Chrome. To bypass this limitation, you need to either:
  + Move Google Chrome to your /Applications directory (the app itself, not a symlink).
  + Install 1Password from outside the Mac App Store (licenses should transfer automatically, but you should contact AgileBits about it).
==> Downloading https://dl.google.com/chrome/mac/stable/GGRO/googlechrome.dmg
######################################################################## 100.0%
==> No checksum defined for Cask google-chrome, skipping verification
==> Symlinking App 'Google Chrome.app' to '/Users/ujpadmin/Applications/Google C
🍺  google-chrome staged at '/opt/homebrew-cask/Caskroom/google-chrome/latest' (207 files, 190M)
mba13:~ ujpadmin$

 インストールされた模様.ファイルを確認してみる.

mba13:~ ujpadmin$ ls -la /Users/ujpadmin/Applications/Google\ Chrome.app
lrwxr-xr-x  1 ujpadmin  AUR#003A\Domain Users  66  4  7 13:24 /Users/ujpadmin/Applications/Google Chrome.app -> /opt/homebrew-cask/Caskroom/google-chrome/latest/Google Chrome.app
mba13:~ ujpadmin$
ここでパスがログインユーザのホームディレクトリ配下にあるApplicationsフォルダである事に注意する.
オリジナルの角の場所は次の通り.

/opt/homebrew-cask/Caskroom/google-chrome/latest/Google\ Chrome.app

mba13:~ ujpadmin$ ls -la  /opt/homebrew-cask/Caskroom/google-chrome/latest/
total 576
lrwxr-xr-x@ 1 ujpadmin  AUR#003A\Domain Users      13  4  7 13:24   -> /Applications
drwxr-xr-x  8 ujpadmin  staff                     272  4  7 13:24 .
drwxr-xr-x  5 ujpadmin  staff                     170  4  7 13:28 ..
-rw-r--r--@ 1 ujpadmin  AUR#003A\Domain Users    8196  4  7 13:28 .DS_Store
-rw-r--r--@ 1 ujpadmin  AUR#003A\Domain Users  214666  3 26 08:13 .VolumeIcon.icns
drwxr-xr-x@ 3 ujpadmin  AUR#003A\Domain Users     102  3 26 10:04 .background
-rwxr-xr-x@ 1 ujpadmin  AUR#003A\Domain Users   58275  3 26 08:12 .keystone_install
drwxr-xr-x@ 3 ujpadmin  AUR#003A\Domain Users     102  3 26 09:51 Google Chrome.app
mba13:~ ujpadmin$
Page Top

VirtualBoxをインストールしてみる anchor.png

 次に,VirtualBoxをインストールしてみる.VirtualBoxはOracleが無償提供している仮想マシン.

 まずは,検索してみる  

mba13:~ ujpadmin$ brew cask search virtualbox
==> Exact match
virtualbox
==> Partial matches
virtualbox-extensio

 2つ関連モジュールがある.本体と拡張パック.両方インストールする.    まずは,VirtualBox本体.  

mba13:~ ujpadmin$ brew cask install virtualbox
==> Downloading http://download.virtualbox.org/virtualbox/5.0.16/VirtualBox-5.0.16-10587
######################################################################## 100.0%
==> Verifying checksum for Cask virtualbox
==> Running installer for virtualbox; your password may be necessary.
==> Package installers may write to any location; options such as --appdir are ignored.
==> installer: Package name is Oracle VM VirtualBox
==> installer: Installing at base path /
==> installer: The install was successful.
🍺  virtualbox staged at '/opt/homebrew-cask/Caskroom/virtualbox/5.0.16-105871' (4 files, 88M)
mba13:~ ujpadmin$

 そして,拡張パック.

mba13:~ ujpadmin$ brew cask install virtualbox-extension-pack
==> Satisfying dependencies
==> Installing Cask dependencies: virtualbox
virtualbox ...
already installed
complete
==> Downloading http://download.virtualbox.org/virtualbox/5.0.16/Oracle_VM_VirtualBox_Ex
######################################################################## 100.0%
==> Verifying checksum for Cask virtualbox-extension-pack
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
Successfully installed "Oracle VM VirtualBox Extension Pack".
🍺  virtualbox-extension-pack staged at '/opt/homebrew-cask/Caskroom/virtualbox-extension-pack/5.0.16-105871' (16M)
mba13:~ ujpadmin$

トップ   差分 バックアップ 複製 名前変更 リロード   ページ新規作成 全ページ一覧 単語検索 最新ページの一覧   ヘルプ   最新ページのRSS 1.0 最新ページのRSS 2.0 最新ページのRSS Atom
Counter: 1530, today: 2, yesterday: 1
最終更新: 2016-04-08 (金) 01:24:37 (JST) (2939d) by shinnai(shinnai)

広告スペース
Google