3
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

MacBook Airでhomebrewが壊れた

Last updated at Posted at 2015-04-03

久しぶりにMacBookでブラウザ以外を動かそうと思ってbrewの更新をしようとしたらしばらく何も使ってないのにエラーorz
こんな壊れる物なん?

$ brew update
/usr/local/bin/brew: /usr/local/Library/brew.rb: /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby: bad interpreter: No such file or directory
/usr/local/bin/brew: line 21: /usr/local/Library/brew.rb: Undefined error: 0

しょうがないので最初からインストール

$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
It appears Homebrew is already installed. If your intent is to reinstall you
should do the following before running this installer again:
    rm -rf /usr/local/Cellar /usr/local/.git && brew cleanup

そしたらふるいの消せよ的なメッセージがw

$ rm -rf /usr/local/Cellar /usr/local/.git && brew cleanup
/usr/local/bin/brew: /usr/local/Library/brew.rb: /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby: bad interpreter: No such file or directory
/usr/local/bin/brew: line 21: /usr/local/Library/brew.rb: Undefined error: 0

rmはうまく動いているだろうけどbrew cleanupで同じようにエラーになってるっぽい
大丈夫かいな

とりあえず、もう一回

$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
You have not agreed to the Xcode license.
Before running the installer again please agree to the license by opening
Xcode.app or running:
    sudo xcodebuild -license

メッセージが変わった。今度はxcode

$ sudo xcodebuild -license

WARNING: Improper use of the sudo command could lead to data loss
or the deletion of important system files. Please double-check your
typing when using sudo. Type "man sudo" for more information.

To proceed, enter your password, or type Ctrl-C to abort.

Password:

    :
  <中略>
    :

キーを適当に叩いて、最後にagreeを叩いて再再インストール

$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
==> This script will install:
/usr/local/bin/brew
/usr/local/Library/...
/usr/local/share/man/man1/brew.1

Press RETURN to continue or any other key to abort
==> /usr/bin/sudo /bin/mkdir /Library/Caches/Homebrew
==> /usr/bin/sudo /bin/chmod g+rwx /Library/Caches/Homebrew
==> Downloading and installing Homebrew...
fatal: unable to access 'https://github.com/Homebrew/homebrew/': SSLRead() return error -9806
Failed during: git fetch origin master:refs/remotes/origin/master -n

今度は動いてるっぽいけどSSLエラー?

$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
It appears Homebrew is already installed. If your intent is to reinstall you
should do the following before running this installer again:
    rm -rf /usr/local/Cellar /usr/local/.git && brew cleanup

また消すのどうなってるのこれ?

$ rm -rf /usr/local/Cellar /usr/local/.git && brew cleanup
/usr/local/bin/brew: /usr/local/Library/brew.rb: /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby: bad interpreter: No such file or directory
/usr/local/bin/brew: line 21: /usr/local/Library/brew.rb: Undefined error: 0

やっぱりエラーになるよね?

$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
==> This script will install:
/usr/local/bin/brew
/usr/local/Library/...
/usr/local/share/man/man1/brew.1

Press RETURN to continue or any other key to abort
==> Downloading and installing Homebrew...
remote: Counting objects: 240663, done.
remote: Total 240663 (delta 0), reused 0 (delta 0), pack-reused 240663
Receiving objects: 100% (240663/240663), 33.71 MiB | 442.00 KiB/s, done.
Resolving deltas: 100% (179175/179175), done.
From https://github.com/Homebrew/homebrew
 * [new branch]      master     -> origin/master
HEAD is now at 3e7fe5b influxdb 0.9.0-rc19 (devel)
==> Installation successful!
==> Next steps
Run `brew help` to get started

再度・・・あ、RETRUNさっきは押してなかったその違い?
今度は正常に入ったっぽい

$ brew doctor
Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry and just ignore them. Thanks!

Warning: Broken symlinks were found. Remove them with `brew prune`:
  /usr/local/bin/7z
  /usr/local/bin/7za
  /usr/local/bin/7zr
  /usr/local/bin/bmp2tiff
  /usr/local/bin/cabextract
    :
  <中略>
    :
  /usr/local/Library/LinkedKegs/wget
  /usr/local/Library/LinkedKegs/wine
  /usr/local/Library/LinkedKegs/winetricks

Warning: Your XQuartz (2.7.4) is outdated
Please install XQuartz 2.7.7:
  https://xquartz.macosforge.org

Warning: You have uncommitted modifications to Homebrew
If this a surprise to you, then you should stash these modifications.
Stashing returns Homebrew to a pristine state but can be undone
should you later need to do so for some reason.
    cd /usr/local/Library && git stash && git clean -d -f

doctorで確認するといろいろとエラーが(汗

$ rm -rf /usr/local/Cellar /usr/local/.git && brew cleanup

今度はエラー出なかった、再インストール

$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
==> This script will install:
/usr/local/bin/brew
/usr/local/Library/...
/usr/local/share/man/man1/brew.1

Press RETURN to continue or any other key to abort
==> Downloading and installing Homebrew...
remote: Counting objects: 240663, done.
remote: Total 240663 (delta 0), reused 0 (delta 0), pack-reused 240663
Receiving objects: 100% (240663/240663), 33.71 MiB | 544.00 KiB/s, done.
Resolving deltas: 100% (179175/179175), done.
From https://github.com/Homebrew/homebrew
 * [new branch]      master     -> origin/master
HEAD is now at 3e7fe5b influxdb 0.9.0-rc19 (devel)
==> Installation successful!
==> Next steps
Run `brew help` to get started

doctorだとやはり同じエラー言われてるコマンドを打ちますか・・・

$ brew prune
Pruned 0 dead formulae
Tapped 155 formulae
Pruned 751 symbolic links and 39 directories from /usr/local
$ cd /usr/local/Library && git stash && git clean -d -f
No local changes to save
Removing Aliases/firefly
Removing Aliases/hugs
Removing Aliases/jslint
Removing Aliases/p4
Removing Aliases/p4d
Removing Aliases/rbx
Removing Aliases/ree
    :
  <中略>
    :
Removing Homebrew/test/test_raise_plus.rb
Removing Homebrew/vendor/LICENSE
Removing Homebrew/vendor/multi_json.rb
Removing Homebrew/vendor/multi_json/

わーなんかいっぱい消されたw

$ brew update
Updated Homebrew from 3e7fe5b4 to 3e7fe5b4.
==> New Formulae
homebrew/dupes/bzip2					    josegonzalez/php/php53-yp
homebrew/dupes/krb5					    josegonzalez/php/php53-yrmcds
homebrew/dupes/libedit					    josegonzalez/php/php53-zookeeper
homebrew/dupes/xar					    josegonzalez/php/php54-augmentedtypes
josegonzalez/php/behat					    josegonzalez/php/php54-binpack
    :
  <中略>
    :
josegonzalez/php/php53-http		josegonzalez/php/php54-http		josegonzalez/php/wp-cli
josegonzalez/php/php53-igbinary		josegonzalez/php/php54-igbinary
==> Deleted Formulae
homebrew/dupes/ab					    josegonzalez/php/abstract-php
homebrew/dupes/ant					    josegonzalez/php/abstract-php-extension
homebrew/dupes/apr					    josegonzalez/php/php-md
homebrew/dupes/apr-util					    josegonzalez/php/php52
homebrew/dupes/httpd					    josegonzalez/php/php53-intl
homebrew/dupes/perl					    josegonzalez/php/php54-intl
$ brew doctor
Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry and just ignore them. Thanks!

Warning: Your XQuartz (2.7.4) is outdated
Please install XQuartz 2.7.7:
  https://xquartz.macosforge.org

うーん、まだ警告でている。
バージョンあげろって事ですね。brew udpateで上がらないのね・・

サイトにいってXQuartz-2.7.7.dmgをダウンロードdmgを開くとこんどはpkgそれも開いてインストール

brew doctorやっぱりさっきと同じようにあげろとでる。
ターミナルを再起動

$ brew doctor
Your system is ready to brew.

いつの間にか壊れてるとか、壊れている自身でcleanupコマンドとかやめてほしいな。

3
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
3
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?