yn2011's blog

技術メモ

xcode-select --installに失敗した

xcode-select --installに失敗したのでXcode Command Line ToolsをApple公式サイトからダウンロードして解決したというお話。

環境

事象

gsedをsedとして呼び出せるようにしようと思いオプション付きでインストール実行。

$ brew install gnu-sed --with-default-names
Error: The following formula
  gnu-sed
cannot be installed as binary package and must be built from source.
Install the Command Line Tools:
  xcode-select --install

なぜか失敗した。このオプションはソースコードのビルドが必要なことがエラーと何か関係していそうではある。
とりあえず指示されたコマンドを実行してみる。

$ xcode-select --install
xcode-select: note: install requested for command line developer tools

すると以下の内容のポップアップウィンドウが表示されてダウンロードに失敗した。

xcode このソフトウェアは、現在ソフトウェア・アップデート・サーバから入手できないため、インストールできません。

解決策

  • Xcode Command Line ToolsはApple公式サイトからも取得することが出来る。
  • More Downloads for Apple DevelopersCommand Line Toolsと検索
  • 自分の環境のOSとXcodeのバージョンの組み合わせに一致するものを選択してダウンロード後にインストール。

インストール成功後に再度コマンドを実行する。

$ brew install gnu-sed --with-default-names
==> Downloading https://ftp.gnu.org/gnu/sed/sed-4.5.tar.xz
######################################################################## 100.0%
==> ./configure --prefix=/usr/local/Cellar/gnu-sed/4.5
==> make install
🍺  /usr/local/Cellar/gnu-sed/4.5: 10 files, 528.5KB, built in 2 minutes 18 seconds

今度は成功。めでたい。

原因不明

  • $ xcode-select --installが失敗する理由はよく分からない...

参考