Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

brew doctor gives incorrect instructions to fix path for fish shell #8965

Closed
3 tasks done
franciscolourenco opened this issue Oct 21, 2020 · 6 comments · Fixed by #11349
Closed
3 tasks done

brew doctor gives incorrect instructions to fix path for fish shell #8965

franciscolourenco opened this issue Oct 21, 2020 · 6 comments · Fixed by #11349
Labels
outdated PR was locked due to age

Comments

@franciscolourenco
Copy link

Bug report

Please note we will close your issue without comment if you delete, do not read or do not fill out the issue checklist below and provide ALL the requested information. If you repeatedly fail to use the issue template, we will block you from ever submitting issues to Homebrew again.

  • ran brew update and can still reproduce the problem?
  • ran brew doctor, fixed all issues and can still reproduce the problem?
  • ran brew config and brew doctor and included their output with your issue?

What you were trying to do (and why)

Run brew doctor, and follow instructions to include /usr/local/sbin in the PATH.

What happened (include command output)

brew doctor

Warning: Homebrew's sbin was not found in your PATH but you have installed
formulae that put executables in /usr/local/sbin.
Consider setting the PATH for example like so:
echo 'set -g fish_user_paths "/usr/local/sbin" $fish_user_paths' >> ~/.config/fish/config.fish

What you expected to happen

According to the fish documentation, the fish_user_paths env variable should not be set in config.fish, but instead PATH should be used. Below you can find what the recommended way to update PATH in config.fish is, according to the docs.

echo 'set -x PATH "/usr/local/sbin" $PATH' >> ~/.config/fish/config.fish

Step-by-step reproduction instructions (by running brew commands)

  1. Use the fish shell
  2. Incorrectly set your path
  3. Run brew doctor
  4. Receive warning suggesting how to fix path

Output of brew config and brew doctor commands

$ brew config
HOMEBREW_VERSION: 2.5.6
ORIGIN: https://github.com/Homebrew/brew
HEAD: abf214c01ff1edb57acf7e23d5eb24a777335e11
Last commit: 9 days ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: 183df8724745baf4b218cc1ff0329ccfc0634a85
Core tap last commit: 34 minutes ago
Core tap branch: master
HOMEBREW_PREFIX: /usr/local
HOMEBREW_CASK_OPTS: []
HOMEBREW_EDITOR: subl --new-window
HOMEBREW_MAKE_JOBS: 4
Homebrew Ruby: 2.6.3 => /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.6.3_2/bin/ruby
CPU: quad-core 64-bit kabylake
Clang: 11.0 build 1103
Git: 2.29.0 => /usr/local/bin/git
Curl: 7.64.1 => /usr/bin/curl
Java: 1.8.0_162, 1.8.0_121
macOS: 10.15.6-x86_64
CLT: 1103.0.32.62
Xcode: N/A


$ brew doctor
Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry or file an issue; just ignore this. Thanks!

Warning: Unknown support status

Warning: A newer Command Line Tools release is available.
Update them from Software Update in System Preferences or run:
  softwareupdate --all --install --force

If that doesn't show you an update run:
  sudo rm -rf /Library/Developer/CommandLineTools
  sudo xcode-select --install

Alternatively, manually download them from:
  https://developer.apple.com/download/more/.


Warning: Some installed formulae were deleted!
You should find replacements for the following formulae:
  python@2

Warning: "config" scripts exist outside your system or Homebrew directories.
`./configure` scripts often look for *-config scripts to determine if
software packages are installed, and which additional flags to use when
compiling and linking.

Having additional scripts in your path can confuse software installed via
Homebrew if the config script overrides a system or Homebrew-provided
script of the same name. We found the following "config" scripts:
  /Applications/Postgres.app/Contents/Versions/latest/bin/gdal-config

Warning: Putting non-prefixed coreutils in your path can cause gmp builds to fail.

Warning: Unbrewed dylibs were found in /usr/local/lib.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.

Unexpected dylibs:
  /usr/local/lib/libboost_system.dylib
  /usr/local/lib/libcrypto.1.0.0.dylib
  /usr/local/lib/libjasper.1.0.0.dylib
  /usr/local/lib/libpteiddlg.1.61.0.dylib
  /usr/local/lib/libpteidhttps.1.61.0.dylib
  /usr/local/lib/libpteidlib.1.61.0.dylib
  /usr/local/lib/libpteidlibopensc.1.61.0.dylib
  /usr/local/lib/libssl.1.0.0.dylib
  /usr/local/lib/pteidpkcs11.1.61.0.dylib

Warning: Unbrewed header files were found in /usr/local/include.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.

Unexpected header files:
  /usr/local/include/pteid/pteiddefines.h
  /usr/local/include/pteid/pteidlib.h

Warning: You have unlinked kegs in your Cellar.
Leaving kegs unlinked can lead to build-trouble and cause brews that depend on
those kegs to fail to run properly once built. Run `brew link` on these:
  python

Warning: Homebrew's sbin was not found in your PATH but you have installed
formulae that put executables in /usr/local/sbin.
Consider setting the PATH for example like so:
  echo 'set -g fish_user_paths "/usr/local/sbin" $fish_user_paths' >> ~/.config/fish/config.fish

@MikeMcQuaid
Copy link
Member

Could you try and open a pull request? This document should help and we're happy to walk you through anything else.

Thanks!

@franciscolourenco
Copy link
Author

I will try

@catthehacker
Copy link

According to the fish documentation, the fish_user_paths env variable should not be set in config.fish, but instead PATH should be used. Below you can find what the recommended way to update PATH in config.fish is, according to the docs.

That is correct, but there is one caveat about this which is not mentioned in docs. This will append $PATH on every host which is using that config.fish, while if paths are added to fish_user_paths, those paths will only remain on the host it was executed on.
fish_user_paths is saved to special file fishd.* where * is MAC address or hostname of the host. This is crucial as it will not bloat $PATH on other hosts that do not have Homebrew or have Homebrew in different location.

Those are correct commands to suggest to users on how to fix $PATH

# set universal $fish_user_paths with values "/usr/local/sbin" and values from $fish_user_paths
set -U fish_user_paths "/usr/local/sbin" $fish_user_paths

fish >= 3.0.0

# append universal $fish_user_paths with "/usr/local/sbin"
set -Ua fish_user_paths "/usr/local/sbin"

fish >= 3.2.0 (https://github.com/fish-shell/fish-shell/blob/0072367512f64e5b3ed152dc34f06b2bd9d7f152/share/functions/fish_add_path.fish)

# fish_add_path is a function that checks if the path is already part of $fish_user_paths and if not, adds it to $fish_user_paths
echo 'fish_add_path "/usr/local/sbin"' >> ~/.config/fish/config.fish

@MikeMcQuaid
Copy link
Member

We'll accept a pull request for this.

@franciscolourenco
Copy link
Author

franciscolourenco commented Nov 16, 2020

Shouldn't the issue remain open until a fix has been merged?

@MikeMcQuaid
Copy link
Member

No, that's not how we manage our issue tracker, sorry.

@BrewTestBot BrewTestBot added the outdated PR was locked due to age label Dec 16, 2020
@Homebrew Homebrew locked as resolved and limited conversation to collaborators Dec 16, 2020
davidxia added a commit to davidxia/brew that referenced this issue May 9, 2021
fixes Homebrew#8965

See Fish docs https://fishshell.com/docs/current/tutorial.html#path.

> A faster way is to use the `fish_add_path function`... 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.
>
> Or you can modify `$fish_user_paths` yourself, but you should be careful not
> to append to it unconditionally in config.fish, or it will grow longer and
> longer.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated PR was locked due to age
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants