Macにhomebrewでyarnをインストールする(macOS Catalina)


Macにhomebrewでyarnをインストールする(macOS Catalina)

Macにhomebrewでyarnをインストールするメモです。
最近 macOS Catalinaに移行したばかり。

とりあえず、$ brew install yarn を実行。

$ brew install yarn
==> Installing dependencies for yarn: icu4c and node
==> Installing yarn dependency: icu4c

(...なんやかんや...)

==> Installing yarn
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
Error: An exception occurred within a child process:
  CompilerSelectionError: yarn cannot be built with any available compilers.
Install GNU's GCC:
  brew install gcc

gccが必要なんですね。すみませんでした。$ brew install gcc を実行。

$ brew install gcc
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
Error: The following formula
  gcc
cannot be installed as binary package and must be built from source.
Install the Command Line Tools:
  xcode-select --install

xcode-selectも言われた通りインストールする。$ xcode-select --install 実行。

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

OK!もっかいgccインストール。

$ brew install gcc

(...なんやかんや...)

==> Installing gcc
==> Downloading https://homebrew.bintray.com/bottles/gcc-9.2.0_1.catalina.bottle.tar.gz
==> Downloading from https://akamai.bintray.com/e1/e1a6cd0d52fb715431063657cec4e3578170079168b612a6998d321d778330b1?__gda__=exp=1571205974~hmac=f8db0bd0
######################################################################## 100.0%

入ったっぽい。もっかいyarnインストール。

$ brew install yarn

(...なんやかんや...)

==> Downloading https://yarnpkg.com/downloads/1.19.1/yarn-v1.19.1.tar.gz
==> Downloading from https://github-production-release-asset-2e65be.s3.amazonaws.com/49970642/45a6eb00-e985-11e9-8d2c-2c9597fae425?X-Amz-Algorithm=AWS4-
######################################################################## 100.0%
🍺  /usr/local/Cellar/yarn/1.19.1: 14 files, 5MB, built in 9 seconds

お、いけたんかな。

$ yarn -v
1.19.1

いけてました。おわり。