.\" Man page generated from reStructuredText .\" by the Docutils 0.23 manpage writer. . . .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" "Oct 15, 2026" "4.9" "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 \fBPATH\fP \%<#\:envvar-PATH>\&. It does this by adding the directories either to \fBfish_user_paths\fP \%<#\:envvar-fish_user_paths> or directly to \fBPATH\fP \%<#\:envvar-PATH> (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 universal variables \%<#\:variables-universal>\&. 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 \fBfish_user_paths\fP \%<#\:envvar-fish_user_paths> if you have that already). If you need more control, consider modifying the variable yourself. .sp Directories are normalized with realpath \%<>\&. 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 \fBPATH\fP \%<#\:envvar-PATH>, so they still stay ahead of the system paths. If the \fB\-\-path\fP option is used, the paths are appended/prepended to \fBPATH\fP \%<#\:envvar-PATH> directly, so this doesn\(aqt happen. .sp With \fB\-\-path\fP, because \fBPATH\fP \%<#\:envvar-PATH> must be a global variable instead of a universal one, the changes won\(aqt persist, so those calls need to be stored in config.fish \%<#\:configuration>\&. This also applies to \fBfish_user_paths\fP \%<#\:envvar-fish_user_paths> if you make it global (for instance by passing \fB\-\-global\fP). .sp If no directory is new, the variable (\fBfish_user_paths\fP \%<#\:envvar-fish_user_paths> or \fBPATH\fP \%<#\:envvar-PATH>) 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 \fBfish_user_paths\fP \%<#\:envvar-fish_user_paths>\&. .TP \fB\-U\fP or \fB\-\-universal\fP Use a universal \fBfish_user_paths\fP \%<#\:envvar-fish_user_paths> \- this is the default if it doesn\(aqt already exist. .TP \fB\-P\fP or \fB\-\-path\fP Manipulate \fBPATH\fP \%<#\:envvar-PATH> 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 set \%<> 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 .\" End of generated man page.