LoginSignup
12

More than 5 years have passed since last update.

Homebrewを'/usr/local' 以外に管理者権限なしでインストールする

Last updated at Posted at 2016-11-24

環境

Mac OS X El Capitan
10.11.6

問題

  • Homebrewをインストールしたい
  • このバージョンから /usr/local の権限周りが変更されており、本家サイトのスクリプトではpermission deniedとなりインストールできない

解決案

手順

権限周りを再帰的に変更したときの副作用が(無いのかもしれないですが)見積もれなかったので、今回は「方法その2」を試してみました。

以下のドキュメントにある通り、に任意の場所にインストールします。
Alternative Installs

 # インストール先のディレクトリを作成
$ mkdir -p ~/my_local/homebrew && cd ~/my_local
$ curl -L https://github.com/Homebrew/brew/tarball/master | tar xz --strip 1 -C homebrew                                    

# .bashrcで環境変数を設定
$ vi ~/.bashrc
 ↓ brew本体は homebrew/binにいるので、そこへのパスを通す
export PATH=$HOME/my_local/homebrew/bin:$PATH
 ↓ キャッシュの保存先の指定
export HOMEBREW_CACHE=$HOME/my_local/homebrew/cache

$ source ~/.bashrc
$ brew --version

おまけ (rsyncのバージョンアップ)

Macのrsyncのバージョンが2系で、リモートのEC2とrsyncすると失敗する現象が起きたので、Mac側を早速Homebrewでバージョンアップしてみます。

$ brew tap homebrew/dupes && brew install rsync             
$ rsync --version
rsync  version 3.1.2                

以上です。

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
12