LoginSignup
0
2

More than 3 years have passed since last update.

PATHを通す

Last updated at Posted at 2020-05-10

PATHを通す方法に関して

ls -la.bash_profileがあるか確認

mbp:~ **** $ ls -la
total 88
 ~ (省略) ~
-rw-------   1 ****  staff   8387  5  6 19:31 .bash_history
-rw-r--r--   1 ****  staff    107  5  2 19:48 .bash_profile
 ~ (省略) ~

.bash_profileがない場合はtouch .bash_profileで作成

mbp:~ **** $ touch .bash_profile

.bash_profileを編集する

// vimで開く
mbp:~ **** $ vi .bash_profile

vimでの編集方法

①vimに入ったら「i」を押して下に「insert」が出るのを確認する

スクリーンショット 2020-05-10 13.16.49.png

②以下の内容を.bash_profileに追記する

(ここではnodeのpathを通しています)

export PATH=$HOME/.nodebrew/current/bin:$PATH
export PATH=$PATH:/Users/****/.nodebrew/current/bin

③vimを閉じる

(英字の状態で)ESCを押してから、:wq

(その他vimを閉じる方法)

// 保存済みのファイルを開いているvimから抜ける
:q

// ファイルを保存しないでvimを抜ける
:q!

vimの編集が終わったら source ~/.bash_profileで更新

// 更新
mbp:~ **** $ source ~/.bash_profile

// PATHが通っているか確認(今回はnodebrewのPATHを通したため)
mbp:~ **** $ nodebrew help

 参考記事

ターミナルの設定ファイルを作る[.bash_profile]
nodebrewを使ってnode.jsを使える環境を作る

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