brew updateで躓いた件


躓きましたので、解消までの道のりを。

brewでインストールしていたscalaのバージョンが2.11.1だったので、2.11.7にしようと思ったのですが、

	$ scala -version
	Scala code runner version 2.11.1 -- Copyright 2002-2013, LAMP/EPFL
	$ brew outdated scala
	scala (2.11.1 < 2.11.7)

なので、

	$ brew info scala
	scala: stable 2.11.7 (bottled), devel 2.12.0-M1
	Scala programming language
	http://www.scala-lang.org/
	/usr/local/Cellar/scala/2.11.1 (45 files, 28M) *
	  Built from source
	From: https://github.com/Homebrew/homebrew/blob/master/Library/Formula/scala.rb
	==> Options
	--with-docs
		Also install library documentation
	--with-src
		Also install sources for IDE support
	--devel
		Install development version 2.12.0-M1
	==> Caveats
	To use with IntelliJ, set the Scala home to:
	  /usr/local/opt/scala/idea
	
	Bash completion has been installed to:
	  /usr/local/etc/bash_completion.d

ふむふむ。

	$ brew update
	error: unable to unlink old '.gitignore' (Permission denied)
	error: unable to create file .travis.yml (Permission denied)
	error: unable to unlink old 'CONTRIBUTING.md' (Permission denied)
	error: unable to unlink old 'README.md' (Permission denied)
	error: unable to unlink old 'SUPPORTERS.md' (Permission denied)
	Error: Failure while executing: git pull --quiet origin refs/heads/master:refs/remotes/origin/master

あり？gitが悪さをするという例のやつか。

	$ git fetch origin
	$ git reset --hard origin/master
	HEAD is now at 62d7e95 tmux: update 2.1 bottle.

よしよし、これで再実行。

	$ brew update
	Error: The /usr/local directory is not writable.
	Even if this directory was writable when you installed Homebrew, other
	software may change permissions on this directory. Some versions of the
	"InstantOn" component of Airfoil are known to do this.

はにゃー。いつの間にか、rootでも色々作業しちゃったのかな。

	$ pwd
	/usr/local
	$ ls -ld
	drwxr-xr-x@ 23 root  wheel  782 10 28 10:40 ./
	$ sudo chown -R $(whoami):admin /usr/local
	Password:

これで、どうだ！？

	$ brew update
	Updated 2 taps (caskroom/cask, homebrew/versions).
	==> New Formulae
	homebrew/versions/android-ndk-r10d       homebrew/versions/iojs                 
	homebrew/versions/apache-spark141        homebrew/versions/node012              
	homebrew/versions/freetds091             homebrew/versions/saxon6               
	homebrew/versions/go14                   homebrew/versions/zeromq405            
	==> Updated Formulae
	homebrew/versions/glfw3                  homebrew/versions/node010

ひゃっほう！

	$ brew outdated
	apr (1.5.1 < 1.5.2)
	apr-util (1.5.4 < 1.5.4_1)
	caskroom/cask/brew-cask (0.54.1 < 0.58.0)
	cairo (1.14.2 < 1.14.2_1)
	czmq (2.2.0_1 < 3.0.2_1)
	fontforge (20150430 < 20150824)
	freetype (2.5.5 < 2.6_1)
	gettext (0.19.4 < 0.19.6)
	glib (2.44.0 < 2.46.1)
	gobject-introspection (1.44.0 < 1.46.0)
	gradle (1.12 < 2.8)
	harfbuzz (0.9.40 < 1.0.4)
	jq (1.4 < 1.5)
	libpng (1.6.17 < 1.6.18)
	libtiff (4.0.3 < 4.0.6)
	node (0.10.28 < 4.2.1)
	openssl (1.0.1h, 1.0.2a-1 < 1.0.2d_1)
	pango (1.36.8 < 1.38.1)
	pixman (0.32.6 < 0.32.8)
	python (2.7.9 < 2.7.10_2)
	sbt (0.13.8 < 0.13.9)
	scala (2.11.1 < 2.11.7)
	scons (2.3.4 < 2.4.0)
	sqlite (3.8.4.3, 3.8.8.3, 3.8.9 < 3.9.1)
	subversion (1.8.8 < 1.8.13)
	tmux (1.9a < 2.1)
	typesafe-activator (1.3.2 < 1.3.6)
	zeromq (4.0.5_2 < 4.1.3)


結構あるので、scala個別ではなくて一気にやっちゃいます。

	$ brew upgrade
	==> Upgrading 28 outdated packages, with result:
	apr 1.5.2, apr-util 1.5.4_1, caskroom/cask/brew-cask 0.58.0, cairo 1.14.2_1, czmq 3.0.2_1, fontforge 20150824, freetype 2.6_1, gettext 0.19.6, glib 2.46.1, gobject-introspection 1.46.0, gradle 2.8, harfbuzz 1.0.4, jq 1.5, libpng 1.6.18, libtiff 4.0.6, node 4.2.1, openssl 1.0.2d_1, pango 1.38.1, pixman 0.32.8, python 2.7.10_2, sbt 0.13.9, scala 2.11.7, scons 2.4.0, sqlite 3.9.1, subversion 1.8.13, tmux 2.1, typesafe-activator 1.3.6, zeromq 4.1.3
	==> Upgrading apr
	==> Downloading https://homebrew.bintray.com/bottles/apr-1.5.2.el_capitan.bottle
	######################################################################## 100.0%
	==> Pouring apr-1.5.2.el_capitan.bottle.tar.gz
	==> Caveats
	This formula is keg-only, which means it was not symlinked into /usr/local.
	
	Apple's CLT package contains apr.
	==> Summary
	🍺  /usr/local/Cellar/apr/1.5.2: 54 files, 1.3M

以下ログ略。

linkに関するエラーがいくつか出たので、それを解消しました。

	Error: You must `brew link fontconfig' before cairo can be installed
	Error: You must `brew link fontconfig' before fontforge can be installed
	Error: You must `brew link fontconfig' before gobject-introspection can be installed
	Error: You must `brew link fontconfig' before harfbuzz can be installed
	Error: You must `brew link fontconfig' before pango can be installed
	Error: You must `brew link gdbm' before python can be installed

いやっほぅ！

	$ scala -version
	Scala code runner version 2.11.7 -- Copyright 2002-2013, LAMP/EPFL