2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

M1 Macでfishシェルを使って、Homebrew経由でnodenvをインストールする手順

Posted at

環境

M1 Mac+fishシェル

はじめに

Homebrew経由でnodenvをインストールしたので、手順をまとめます。

問題

公式ドキュメントはbash/zsh前提が多く、fishシェル環境だと手順が分かりづらいところがありました。

手順

1. Homebrewのインストール

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

2. nodenvのインストール

brew install nodenv

3. nodenvをfishシェルで使えるようにする

まず、初期化コマンドをfishの設定ファイルに追加します。
fish用の初期化コマンドは下記で確認できます。

nodenv init - 

恐らく、以下のような出力になるかと思います。

status --is-interactive; and source (nodenv init -|psub)

''で括ってfishの設定ファイルに追記します。

echo 'status --is-interactive; and source (nodenv init -|psub)' >> ~/.config/fish/config.fish

4. 設定を反映させる

source ~/.config/fish/config.fish

5. nodenvの動作確認

下記を入力し、バージョンが出れば完了!

nodenv --version

おわりに

この手順でやれば、恐らくfishシェルを使って、Homebrew経由でnodenvをインストールできるはずです。

まだ体感できていませんが、これで今後はNode.jsのバージョン管理が楽になるそうなので楽しみです。

参考

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?