-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Inaccurate post-install instructions #808
Comments
IMHO, this instruction should be updated too.
and it looks like that |
Thanks for the issue @uvlad7! CC @Homebrew/maintainers folks for thoughts and help. My experience here is that there is the "proper location" ( |
I think
bash --login Usually, the login shell mode can be configured by the terminal simulator. It is similar to if is login shell:
if ~/.bash_profile exists; then
source ~/.bash_profile
elif ~/.profile exists; then
source ~/.profile # ~/.profile will not be read if ~/.bash_profile exists
fi
else
if ~/.bashrc exists; then
source ~/.bashrc # bash will not read ~/.bash_profile on non-login shell mode
fi
fi In the default configuration, # ~/.bash_profile
if [[ -f ~/.bashrc ]]; then
source ~/.bashrc
fi So |
@XuehaiPan Agreed. Could you open a PR for this to Homebrew/install and Homebrew/brew? 🙇🏻 |
Opened a PR to resolve this. |
@XuehaiPan, but profile files are sourced only once, just a little performance optimization. And guidelines say that I've added this into my
and it works just fine. It's just important not to forget to activate it before sourcing |
@uvlad7 On Ubuntu, it will source the For subshell, for example run $ # in a bash login session
$ bash # enter a subshell
bash:~$ # this is not a login shell and will only source `~/.bashrc` the subshell will not source |
but
But it's not OK for competions. Look, I've removed them from my .bashrc and added into .profile, it doesn't work, because completions don't work in child processes
|
@uvlad7 Only exported variables are environment variables that can be inherited to subshells. In your second example, the variable without
Completions are usually defined by functions rather than environment variables. They are not inherited. You need to eval the |
I don't think this is universally the case. It's not on macOS. We should not be relying on the user having this, which makes
shellenv doesn't touch completions. It's purely about environment variables. |
@XuehaiPan , that's exactly what I wanted to highlight in the examples |
@Bo98 that's why rcfiles aren't the right place for shellenv, and profile files are. It's about selecting the right profile file, not about moving everything into rcfiles, at least because there is no rc file for pure sh and people may want to use brew from it.
|
@Bo98 If the |
I wonder if we should just make this output vary definitely per-OS and perhaps per-distro as it seems there's no single option that works consistently everywhere. If we really must pick one option, though: macOS takes priority: it has dramatically more users than Linux. |
@uvlad7 We actively do not support this. This type of edge-case optimisation is not the right call here, sorry. |
Just noticed an interesting thing that cat complicate debug process. So, So, you can't just relogin to check your changes. I reproduced that behavior again: I moved initialization back into
into
So, UPD: ENVs set during login are kept. I just added
|
I made |
@gromgit may have thoughts here. |
I'd have to agree that the rcfile is the most pragmatic place to add
As for macOS, unless folks have been complaining that |
install
oruninstall
script?brew config
andbrew doctor
and included their output with your issue? If you couldn't install: provided your OS version with the output of your issue?My OS is Ubuntu 22.04.3 LTS. I don't think
brew config
andbrew doctor
are relevant here, buthere is the output
What you were trying to do (and why)
I installed brew with the following command
and added this line
into my
.bash_profile
file, just like it suggested. Then, I evaluatedand brew worked just fine. Then I logged out and logged in back, expecting brew to work, but it didn't
What happened (include command output)
brew
wasn't found in the pathCommand output
What you expected to happen
I expected
brew
to be in the pathStep-by-step reproduction instructions (by running
brew
commands)It looks like I described it above, and I've found why it happened - Ubuntu doesn't source
.bash_profile
on login into Xorg session, it sources.profile
, despite$SHELL
is/bin/bash
, here is a bug. And I found that your docs says to add brew via.profile
on Ubuntu/Debian, so you must have been aware of this problem. But the Next steps instructions in the install script don't highlight it.The text was updated successfully, but these errors were encountered: