5
5

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 3 years have passed since last update.

fish_user_paths を config.fish で設定するな

Last updated at Posted at 2020-06-11

fish shell の使い方について調べると、$fish_user_paths を使うのが "fisher way" である(fish ユーザー的に良い書き方である)ことがしばしば紹介されています。

set -U fish_user_paths /usr/local/bin $fish_user_paths

$fish_user_paths を使うメリットとしては、ここで一度内容を設定すれば、自動的に今開いているセッション及び将来開くセッション全ての $PATH に永久的に設定が保存されるという点です。

逆に言えば、$fish_user_paths~/.config/fish/config.fish で設定してはいけません。 config.fish は fish 起動時に毎回呼び出されるので、もし $fish_user_pathsconfig.fish で修正してしまうと、毎回 fish 起動時に $PATH に新しい内容が追加されてしまい、$PATH がどんどん長くなっていってしまいます。

config.fish で書くべきなのは、以下のようなコマンドです。

set -x PATH /usr/local/bin $PATH

参考: https://fishshell.com/docs/current/tutorial.html#path

The advantage is that you don't have to go mucking around in files: just run this once at the command line, and it will affect the current session and all future instances too. (Note: you should NOT add this line to config.fish. If you do, the variable will get longer each time you run fish!)

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?