UJP - 技術情報1

Life is fun and easy!

不正IP報告数

Okan Sensor
 
メイン
ログイン
ブログ カテゴリ一覧

HomeBrewをMacOS X 10.14.4 Mojavaにインストール

HomeBrewをMacOS X 10.14.4 Mojavaにインストール


更新履歴

  • 初版 2019/06/06
       

はじめに

  • Yosemite以降,High Sierraまでは同じ手順でインストールができていたが,Mojaveになってから?対応するXcodeがバージョンアップしてから?Xcodeのインストールパスが変更されたようで新規インストールの場合エラーがでて進まない問題がある.
  • この記事では,そのエラーも体験しながら,エラーを解決してインストールを進める.
       

バージョンの確認.

       
  • これからインストールを行う対象のマシンのOSバージョンを確認.
       
       MBA2013:Users ujpadmin$ sw_vers🆑
       ProductName:	Mac OS X
       ProductVersion:	10.14.4
       BuildVersion:	18E227
       MBA2013:Users ujpadmin$
       
  • macos 10.14なので,通称mojaveというもの.
       
  • Xcodeは,あらかじめApp Storeからインストール済み.
       
       MBA2013:Users ujpadmin$ xcodebuild -version🆑
       Xcode 10.2.1
       Build version 10E1001
       MBA2013:Users ujpadmin$
       
  • 現時点(2019/06/06)で最新版.
       

HomeBrewをインストールする(失敗する)

       
  • いつものように公式サイトに記載されている通りに,rubyをインストール.
       
       MBA2013:Users ujpadmin$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"🆑
       ==> This script will install:
       /usr/local/bin/brew
       /usr/local/share/doc/homebrew
       /usr/local/share/man/man1/brew.1
       /usr/local/share/zsh/site-functions/_brew
       /usr/local/etc/bash_completion.d/brew
       /usr/local/Homebrew
       ==> The Xcode Command Line Tools will be installed.
       
       Press RETURN to continue or any other key to abort
       
  • インストールを続けるので,リターンキーを押下.
       
       ==> Searching online for the Command Line Tools
       ==> /usr/bin/sudo /usr/bin/touch /tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress
       Password:
       
  • Macの開発環境であるXcodeのコマンドラインツールをインストールするので,ログインしているユーザのパスワードを入力.(ユーザアカウントには,管理者権限が必要)
       
       ==> Installing the Command Line Tools (expect a GUI popup):
       ==> /usr/bin/sudo /usr/bin/xcode-select --install
       xcode-select: note: install requested for command line developer tools
       Press any key when the installation has completed.
       
  • 何かキーを押すことで,インストールが始まるというので,リターンキーを押下.
       
       ==> /usr/bin/sudo /usr/bin/xcode-select --switch /Library/Developer/CommandLineTools
       xcode-select: error: invalid developer directory '/Library/Developer/CommandLineTools'
       Failed during: /usr/bin/sudo /usr/bin/xcode-select --switch /Library/Developer/CommandLineTools
       MBA2013:Users ujpadmin$
       
  • エラーがでて失敗.invalid developer directory となっているので,インストール先のディレクトリである/Library/Developer/CommandLineToolsに問題がある模様.
       
  • コマンドラインで,デベロッパ用のディレクトリを確認.
       
       MBA2013:Users ujpadmin$ /usr/bin/xcode-select -p
       /Applications/Xcode.app/Contents/Developer
       MBA2013:Users ujpadmin$
       
  • ディレクトリが異なる模様.
       

Xcodeをスイッチする

       
  • Xcodeのインストールディレクトリが変更された?ようなので,コマンドラインで切り替える.
       
       MBA2013:Users ujpadmin$ sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer
       Password:
       MBA2013:Users ujpadmin$
       
  • 切り替えられたことを確認.
       
       MBA2013:Users ujpadmin$ xcode-select -p🆑
       /Applications/Xcode.app/Contents/Developer
       MBA2013:Users ujpadmin$
       
  • 再度,HomeBrewのインストールを行う.
       
       MBA2013:Users ujpadmin$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"🆑
       ==> This script will install:
       /usr/local/bin/brew
       /usr/local/share/doc/homebrew
       /usr/local/share/man/man1/brew.1
       /usr/local/share/zsh/site-functions/_brew
       /usr/local/etc/bash_completion.d/brew
       /usr/local/Homebrew
       ==> The Xcode Command Line Tools will be installed.
       
       Press RETURN to continue or any other key to abort
       ==> Searching online for the Command Line Tools
       ==> /usr/bin/sudo /usr/bin/touch /tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress
       ==> Installing the Command Line Tools (expect a GUI popup):
       ==> /usr/bin/sudo /usr/bin/xcode-select --install
       xcode-select: note: install requested for command line developer tools
       Press any key when the installation has completed.
       ==> /usr/bin/sudo /usr/bin/xcode-select --switch /Library/Developer/CommandLineTools
       xcode-select: error: invalid developer directory '/Library/Developer/CommandLineTools'
       Failed during: /usr/bin/sudo /usr/bin/xcode-select --switch /Library/Developer/CommandLineTools
       MBA2013:Users ujpadmin$
       
  • 残念.エラーは変わらず.これは,インストーラがパスをハードコーディングしているから.
  • 以下のURLにあるスクリプトを確認して見ると...
       
       https://raw.githubusercontent.com/Homebrew/install/master/install
       
  • いたるところに/Library/Developer/CommandLineToolsにスイッチするように記載がある...
  • インストーラを修正するのは恒久的なことを考えたら影響が大きいような気がするので,シンボリックリンクで対応する.
       

/Library/Developer/CommandLineToolsのシンボリックリンクを作成

       
  • 問題は/Library/Developer/CommandLineToolsがないことなので,最新の/Applications/Xcode.app/Contents/Developerへのシンボリックリンクを作成する.
       
  • まずは,現在の上位ディレクトリの確認.
       
       MBA2013:Users ujpadmin$ ls -la /Library/Developer🆑
       total 0
       drwxr-xr-x   3 root  admin    96  2 28 11:36 .
       drwxr-xr-x+ 63 root  wheel  2016  6  4 18:53 ..
       drwxr-xr-x   4 root  admin   128  3 13 11:53 PrivateFrameworks
       MBA2013:Users ujpadmin$
  • ここに,CommandLineToolsのリンクを作成する.
       
       MBA2013:Users ujpadmin$ sudo ln -s /Applications/Xcode.app/Contents/Developer /Library/Developer/CommandLineTools🆑
       MBA2013:Users ujpadmin$
       
  • リンクが作成されたか確認する.
       
       MBA2013:Users ujpadmin$ ls -la /Library/Developer🆑
       total 0
       drwxr-xr-x   4 root  admin   128  6  6 11:49 .
       drwxr-xr-x+ 63 root  wheel  2016  6  4 18:53 ..
       lrwxr-xr-x   1 root  admin    42  6  6 11:49 CommandLineTools -> /Applications/Xcode.app/Contents/Developer
       drwxr-xr-x   4 root  admin   128  3 13 11:53 PrivateFrameworks
       MBA2013:Users ujpadmin$
       
  • これで,再度インストールを行う.
       

HomeBrewをインストールする()

       
       
       MBA2013:Users ujpadmin$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"🆑
       ==> This script will install:
       /usr/local/bin/brew
       /usr/local/share/doc/homebrew
       /usr/local/share/man/man1/brew.1
       /usr/local/share/zsh/site-functions/_brew
       /usr/local/etc/bash_completion.d/brew
       /usr/local/Homebrew
       
       Press RETURN to continue or any other key to abort🆑
       ==> Downloading and installing Homebrew...
       remote: Enumerating objects: 54, done.
       remote: Counting objects: 100% (54/54), done.
       remote: Compressing objects: 100% (37/37), done.
       remote: Total 124174 (delta 18), reused 45 (delta 17), pack-reused 124120
       Receiving objects: 100% (124174/124174), 29.34 MiB | 1.14 MiB/s, done.
       Resolving deltas: 100% (90987/90987), done.
       From https://github.com/Homebrew/brew
        * [new branch]      master     -> origin/master
        * [new tag]         0.1        -> 0.1
        * [new tag]         0.2        -> 0.2
        * [new tag]         0.3        -> 0.3
        * [new tag]         0.4        -> 0.4
        * [new tag]         0.5        -> 0.5
        * [new tag]         0.6        -> 0.6
        * [new tag]         0.7        -> 0.7
        * [new tag]         0.7.1      -> 0.7.1
        * [new tag]         0.8        -> 0.8
        * [new tag]         0.8.1      -> 0.8.1
        * [new tag]         0.9        -> 0.9
       〜略〜
        * [new tag]         2.1.3      -> 2.1.3
        * [new tag]         2.1.4      -> 2.1.4
       HEAD is now at 80230eccf Merge pull request #6210 from lembacon/pkg-config-catalina
       ==> Homebrew is run entirely by unpaid volunteers. Please consider donating:
         https://github.com/Homebrew/brew#donations
       ==> Tapping homebrew/core
       Cloning into '/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core'...
       remote: Enumerating objects: 5001, done.
       remote: Counting objects: 100% (5001/5001), done.
       remote: Compressing objects: 100% (4792/4792), done.
       remote: Total 5001 (delta 51), reused 796 (delta 16), pack-reused 0
       Receiving objects: 100% (5001/5001), 4.01 MiB | 1.08 MiB/s, done.
       Resolving deltas: 100% (51/51), done.
       Checking out files: 100% (5018/5018), done.
       Tapped 2 commands and 4787 formulae (5,043 files, 12.5MB).
       Already up-to-date.
       ==> Installation successful!🆑
       
       ==> Homebrew has enabled anonymous aggregate formulae and cask analytics.
       Read the analytics documentation (and how to opt-out) here:
         https://docs.brew.sh/Analytics
       
       ==> Homebrew is run entirely by unpaid volunteers. Please consider donating:
         https://github.com/Homebrew/brew#donations
       ==> Next steps:
       - Run `brew help` to get started
       - Further documentation:
           https://docs.brew.sh
       MBA2013:Users ujpadmin$
       

インストール後の確認処理

       
  • brew doctorコマンドで,インストールに問題なかったか確認.
       
       MBA2013:Users ujpadmin$ brew doctor🆑
       Your system is ready to brew.
       MBA2013:Users ujpadmin$
       
  • 問題ない模様.
       
       MBA2013:Users ujpadmin$ brew --config🆑
       HOMEBREW_VERSION: 2.1.4
       ORIGIN: https://github.com/Homebrew/brew
       HEAD: d5a90f6f4af0a8e3d0ff1d806fb65e1b3bdbbe42
       Last commit: 10 days ago
       Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
       Core tap HEAD: c58dce188e274656041f0dd72aca59a8a968248d
       Core tap last commit: 6 hours ago
       HOMEBREW_PREFIX: /usr/local
       CPU: quad-core 64-bit haswell
       Homebrew Ruby: 2.3.7 => /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby
       Clang: 10.0 build 1001
       Git: 2.20.1 => /Applications/Xcode.app/Contents/Developer/usr/bin/git
       Curl: 7.54.0 => /usr/bin/curl
       macOS: 10.14.4-x86_64
       CLT: N/A
       Xcode: 10.2.1
       MBA2013:Users ujpadmin$
  • 問題ないかどうかは,わからんな.

広告スペース
Google