Installing Homebrew on Linux #25163
-
I’m attempting to install Homebrew in a Linux build by doing the below:
But I get the following error:
I did find out though if I run source ~/.profile && brew --version in the second step it does work. My question is, is there a way to have source ~/.profile retained between each step in a job? Is there a better way to go about doing this? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
It is very strange, I tested the same installation steps on the on GitHub-hosted Ubuntu runner and my own Ubuntu machine (a VM), on my own Ubuntu VM all the steps can work fine without errors, but on GitHub-hosted Ubuntu runner I also get the same error as your reported. Below is the steps I use, I did a little changes based on yours:
You can see in the second step " Verify Homebrew’s Installation", I tried to print the contexts of the shell profile scripts, I can confirm the line " export PATH="/home/linuxbrew/.linuxbrew/bin:$PATH" indeed has been added into shell profile scripts. But the command " brew --version" still always returns " brew: command not found". I have reported this question to the appropriate engineering team for further investigation and evaluation. If they have any progress, I will notify you in time, and sometimes the appropriate engineers may directly reply you here. |
Beta Was this translation helpful? Give feedback.
-
According to the discussion with the appropriate engineers, the shell profile script ( .profile , .bashrc or . bash_profile ) is only read for interactive login shells. more details, see here. If you want to add Homebrew to the PATH for all the subsequent steps in the same job, you can directly add Homebrew’s directory in PATH via the command " ::add-path::{path}", reference here:
So the below workflow can work as expected:
|
Beta Was this translation helpful? Give feedback.
-
Excellent! Thank you very much for your assistance 😊 |
Beta Was this translation helpful? Give feedback.
@destinyb-realityi ,
According to the discussion with the appropriate engineers, the shell profile script ( .profile , .bashrc or . bash_profile ) is only read for interactive login shells. more details, see here.
If you want to add Homebrew to the PATH for all the subsequent steps in the same job, you can directly add Homebrew’s directory in PATH via the command " ::add-path::{path}", reference here:
So the below workflow can work as expected: