2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

ターミナルからコマンドでファイルをコンパイルする際のPATHの指定

2
Last updated at Posted at 2015-10-19

タイトルが真意からそれてないか不安ですが
ターミナルからコマンドでCUDAの動作確認をするために、PATHを通す必要があったので、初めてやり方を学びました。

~/.bashrcてどこにあるの?

最初から存在するフォルダかと勘違いしていたのですが、自分で作らなければ模様。

$ vi ~/.bashrc      #デフォルトで読み込む用
$ vi ~/.bash_profile  #login時に読み込む用

まあどちらも作っておきます。
とりあえず一方のコマンドを打ったら、下の方に

"~/.bashrc" [new file]

と出てくると思うので

:wq

を入力してファイルを保存。
正直vimは入力が面倒くさいのでできればテキストエディタを使いたいところ。

そこで

$ defaults write com.apple.finder AppleShowAllFiles TRUE
$ killall Finder #Finderを再起動して変更を適用する

で隠れファイルを見えるようにして、Finderの方から.bashrcファイルを開けるようにしました。(まあコマンドで打てばいいんだけど、sublimeで開こうとしたらなんかうまくいかなかったのでGUIで操作する方が簡単だなので)
戻すときは

$ defaults write com.apple.finder AppleShowAllFiles FALSE
$ killall Finder

~/.bashrcファイルをエディタで開いたら、

export PATH=/usr/local/cuda/bin:$PATH
export DYLD_LIBRARY_PATH=/usr/local/cuda/lib:$DYLD_LIBRARY_PATH
export C_INCLUDE_PATH=/Developer/CUDA/common/inc
export CPLUS_INCLUDE_PATH=/Developer/CUDA/common/inc

こんな感じでCUDAのPATHを指定する。

PATHが通ってるかの確認は

$ printenv PATH

ちかれた…。

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?