.\" Man page generated from reStructuredText. . . .nr rst2man-indent-level 0 . .de1 rstReportMargin \\$1 \\n[an-margin] level \\n[rst2man-indent-level] level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] - \\n[rst2man-indent0] \\n[rst2man-indent1] \\n[rst2man-indent2] .. .de1 INDENT .\" .rstReportMargin pre: . RS \\$1 . nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] . nr rst2man-indent-level +1 .\" .rstReportMargin post: .. .de UNINDENT . RE .\" indent \\n[an-margin] .\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] .nr rst2man-indent-level -1 .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] .in \\n[rst2man-indent\\n[rst2man-indent-level]]u .. .TH "FISH_ADD_PATH" "1" "Nov 13, 2025" "4.2" "fish-shell" .SH NAME fish_add_path \- add to the path .SH SYNOPSIS .nf \fBfish_add_path\fP \fBpath\fP \&... \fBfish_add_path\fP [(\fB\-g\fP | \fB\-\-global\fP) | (\fB\-U\fP | \fB\-\-universal\fP) | (\fB\-P\fP | \fB\-\-path\fP)] [(\fB\-m\fP | \fB\-\-move\fP)] [(\fB\-a\fP | \fB\-\-append\fP) | (\fB\-p\fP | \fB\-\-prepend\fP)] [(\fB\-v\fP | \fB\-\-verbose\fP) | (\fB\-n\fP | \fB\-\-dry\-run\fP)] \fIPATHS\fP \&... .fi .sp .SH DESCRIPTION .sp \fBfish_add_path\fP is a simple way to add more directories to fish\(aqs \fI\%PATH\fP\&. It does this by adding the directories either to \fI\%fish_user_paths\fP or directly to \fI\%PATH\fP (if the \fB\-\-path\fP switch is given). .sp It is (by default) safe to use \fBfish_add_path\fP in config.fish, or it can be used once, interactively, and the paths will stay in future because of \fI\%universal variables\fP\&. This is a \(dqdo what I mean\(dq style command \- it tries to do the right thing by default, and follow your lead on what you have already set up (e.g. by using a global \fI\%fish_user_paths\fP if you have that already). If you need more control, consider modifying the variable yourself. .sp Directories are normalized with \fI\%realpath\fP\&. Trailing slashes are ignored and relative paths are made absolute (but symlinks are not resolved). If a directory is already included, it is not added again and stays in the same place unless the \fB\-\-move\fP switch is given. .sp Directories are added in the order they are given, and they are prepended to the path unless \fB\-\-append\fP is given. If $fish_user_paths is used, that means they are last in $fish_user_paths, which is itself prepended to \fI\%PATH\fP, so they still stay ahead of the system paths. If the \fB\-\-path\fP option is used, the paths are appended/prepended to \fI\%PATH\fP directly, so this doesn\(aqt happen. .sp With \fB\-\-path\fP, because \fI\%PATH\fP must be a global variable instead of a universal one, the changes won\(aqt persist, so those calls need to be stored in \fI\%config.fish\fP\&. This also applies to \fI\%fish_user_paths\fP if you make it global (for instance by passing \fB\-\-global\fP). .sp If no directory is new, the variable (\fI\%fish_user_paths\fP or \fI\%PATH\fP) is not set again or otherwise modified, so variable handlers are not triggered. .sp If an argument is not an existing directory, \fBfish_add_path\fP ignores it. .SH OPTIONS .INDENT 0.0 .TP \fB\-a\fP or \fB\-\-append\fP Add directories to the \fIend\fP of the variable. .TP \fB\-p\fP or \fB\-\-prepend\fP Add directories to the \fIfront\fP of the variable (this is the default). .TP \fB\-g\fP or \fB\-\-global\fP Use a global \fI\%fish_user_paths\fP\&. .TP \fB\-U\fP or \fB\-\-universal\fP Use a universal \fI\%fish_user_paths\fP \- this is the default if it doesn\(aqt already exist. .TP \fB\-P\fP or \fB\-\-path\fP Manipulate \fI\%PATH\fP directly. .TP \fB\-m\fP or \fB\-\-move\fP Move already\-included directories to the place they would be added \- by default they would be left in place and not added again. .TP \fB\-v\fP or \fB\-\-verbose\fP Print the \fI\%set\fP command used, and some more warnings, like when a path is skipped because it doesn\(aqt exist or is not a directory. Verbose mode is automatically enabled when fish_add_path is used interactively and the output goes to the terminal. .TP \fB\-n\fP or \fB\-\-dry\-run\fP Print the \fBset\fP command that would be used without executing it. .TP \fB\-h\fP or \fB\-\-help\fP Displays help about using this command. .UNINDENT .sp If \fB\-\-move\fP is used, it may of course lead to the path swapping order, so you should be careful doing that in config.fish. .SH EXAMPLE .INDENT 0.0 .INDENT 3.5 .sp .EX # I just installed mycoolthing and need to add it to the path to use it. # It is at /opt/mycoolthing/bin/mycoolthing, # so let\(aqs add the directory: /opt/mycoolthing/bin. > fish_add_path /opt/mycoolthing/bin # I want my ~/.local/bin to be checked first, # even if it was already added. > fish_add_path \-m ~/.local/bin # I prefer using a global fish_user_paths # This isn\(aqt saved automatically, I need to add this to config.fish # if I want it to stay. > fish_add_path \-g ~/.local/bin ~/.otherbin /usr/local/sbin # I want to append to the entire $PATH because this directory contains fallbacks # This needs \-\-path/\-P because otherwise it appends to $fish_user_paths, # which is added to the front of $PATH. > fish_add_path \-\-append \-\-path /opt/fallback/bin # I want to add the bin/ directory of my current $PWD (say /home/nemo/) # \-v/\-\-verbose shows what fish_add_path did. > fish_add_path \-v bin/ set fish_user_paths /home/nemo/bin /usr/bin /home/nemo/.local/bin # I have installed ruby via homebrew > fish_add_path /usr/local/opt/ruby/bin .EE .UNINDENT .UNINDENT .SH COPYRIGHT fish-shell developers .\" Generated by docutils manpage writer. .