LoginSignup
3

More than 3 years have passed since last update.

【2019年5月版】Mac+nvm環境で brew install yarn

Last updated at Posted at 2019-05-04

Mac の nvm 環境に Homebrew で yarn をインストール

対象環境

OS: macOS High Sierra 10.13.6
Homebrew : 2.1.1
nvm: 0.34.0

手順

以下のコマンドを打つだけ。

$ brew install yarn

ただし、以下を注意。

注意事項

こちらの公式サイトのmacOSでの yarn のインストール方法にある通り、

If you use nvm or similar, you should ensure that your PATH lists nvm’s shims before the version of Node.js installed by Homebrew.

'nvm で作成した node のエイリアスが brew で install する node より前に PATHに入っているようにしてね〜'ということなので念のため PATH をチェックしましょう!

さらに注意

nvm のインストール時に".bashrcにパス追加してね!"というコメントがありますが、macOSでは一筋縄では行きません。

詳しくはこちらの「macOSのターミナル(bash)のプロンプトを変えました。」にありますが、要はデフォルトでは mac のターミナルの起動時には .bashrcsource されないってことです。

上記の記事にある通り、.bash_profile.bashrcsourceしておくのを忘れずに!ということで〜

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