LoginSignup
1
3

More than 5 years have passed since last update.

homebrewが/Library/Cachesを見に行ってしまう。

Last updated at Posted at 2013-08-06

brew install gitとかすると/Library/Cachesを見に行ってしまい、permission deniedって怒られてしまう状況になってしまった。

-% brew install git
Error: Permission denied - /Library/Caches

こんな感じ

どうも~/Library/Caches/Homebrewってディレクトリがないと/Library/Caches/Homebrewをキャッシュに使うようになってるみたい。

なのでディレクトリ作ってやったらちゃんと動くようになりました。
勢い余って消しちゃったのかしらん。。

ちなみに

global.rbの18行目あたりからが多分該当箇所

/usr/local/Library/Homebrew/global.rb
def cache
  if ENV['HOMEBREW_CACHE']
    Pathname.new(ENV['HOMEBREW_CACHE'])
  else
    # we do this for historic reasons, however the cache *should* be the same
    # directory whichever user is used and whatever instance of brew is executed
    home_cache = Pathname.new("~/Library/Caches/Homebrew").expand_path
    if home_cache.directory? and home_cache.writable_real?
      home_cache
    else
      root_cache = Pathname.new("/Library/Caches/Homebrew")
      class << root_cache
        alias :oldmkpath :mkpath
        def mkpath
          unless exist?
            oldmkpath
            chmod 0777
          end
        end
      end
      root_cache
    end
  end
end
1
3
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
1
3