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

set environment with brew shellenv #9

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

simonrouse9461
Copy link

See issue #8
brew shellenv already generates all the necessary codes for setting up shell environment. Using its output is the best approach.

Homebrew install its brew binary as /usr/local/bin/brew by default. User can provide custom installation location by setting $HOMEBREW_BIN in before.init.fish.

@m0nhawk
Copy link

m0nhawk commented Jun 22, 2020

Is there any change getting this merged? It's a nice edition and actualization for the plugins.

@metawave
Copy link

metawave commented Jan 21, 2021

@simonrouse9461 I like the your PR.... especially not setting the PATH but rather $fish_user_paths but I hesitate on the set $HOMEBREW_BIN path in before.init.fish part..... there are only a few recommended installation locations for brew... you could try to add a simple discovery mechanism to detect and configure the location of brew, of course a user could provide further locations... I do something similar in my attempt to make brew work for multiple plattforms linux (wsl at work) and macOS at home (couldn't test the apple silicon location so far):

# search in recomended installation locations (macOS, macOS M1, Linux (global/default), Linux alternative method)
set -l possible_brew_paths /usr/local/bin/brew /opt/homebrew/bin/brew /home/linuxbrew/.linuxbrew/bin/brew ~/.linuxbrew/bin/brew 
for possible_brew_path in $possible_brew_paths
	if test -f $possible_brew_path
		eval ($possible_brew_path shellenv)
	end
end

this supports all default locations for brew on macOS (including Apple Silicon) and Linux default/global and user-based location, thus making even https://github.com/oh-my-fish/plugin-linuxbrew obsolete

created a fork https://github.com/metawave/plugin-brew based on your work and I'm currently testing it....

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants