0

So the problem looks like that : I followed all the instructions from https://docs.brew.sh/Homebrew-on-Linux , to install oh my posh via brew.

The problem is that I think I putted a wrong path while copy pasting the instruction's code here :

The installation script installs Homebrew to /home/linuxbrew/.linuxbrew using sudo if possible and within your home directory at ~/.linuxbrew otherwise. Homebrew does not use sudo after installation. Using /home/linuxbrew/.linuxbrew allows the use of more binary packages (bottles) than installing in your personal home directory. The prefix /home/linuxbrew/.linuxbrew was chosen so that users without admin access can ask an admin to create a linuxbrew role account and still benefit from precompiled binaries. If you do not yourself have admin privileges, consider asking your admin staff to create a linuxbrew role account for you with home directory set to /home/linuxbrew.

Follow the Next steps instructions to add Homebrew to your PATH and to your bash shell profile script, either ~/.profile on Debian/Ubuntu or ~/.bash_profile on CentOS/Fedora/Red Hat.

test -d ~/.linuxbrew && eval "$(~/.linuxbrew/bin/brew shellenv)"
test -d /home/linuxbrew/.linuxbrew && eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
test -r ~/.bash_profile && echo "eval \"\$($(brew --prefix)/bin/brew shellenv)\"" >> ~/.bash_profile
echo "eval \"\$($(brew --prefix)/bin/brew shellenv)\"" >> ~/.profile

And when i copy paste this piece of code it works on the actual terminal, but when i close the terminal and open again or open an other tab, and try the command "brew" again for example, it says

zsh: command not found: brew

so for sure I messed up with some path directions. I am not so good in linux, lets say maybe a junior intermediate level, but for this I am stuck, any help would be appreciated thanks

thrig
  • 34,333
  • 3
  • 63
  • 84

2 Answers2

1

zsh does not read .bash_profile nor .profile. You will either need to switch your shell to bash, or instead write the configuration to .zprofile which your shell zsh does read:

echo "eval \"\$($(brew --prefix)/bin/brew shellenv)\"" >> ~/.zprofile
Gilles 'SO- stop being evil'
  • 807,993
  • 194
  • 1,674
  • 2,175
thrig
  • 34,333
  • 3
  • 63
  • 84
  • when I paste this in the terminal it says " zsh: command not found: brew " – Game0verZeus Aug 16 '22 at 19:42
  • then you'll need to find where `brew` got installed to and use `/the/full/path/to/brew` or to add the `brew` directory to `PATH` – thrig Aug 16 '22 at 20:21
  • okay got it, can you maybe give me some tips to how find the full path? after some research yesterday I think it was in /etc/zsh and i have all these folders : newuser.zshrc.recommended zlogin zprofile zshenv newuser.zshrc.recommended.original zlogout zprofile.original zshrc – Game0verZeus Aug 17 '22 at 09:38
  • "The installation script installs Homebrew to ..." so `brew` is probably under `bin` in one or the other of those installation directories, assuming those instructions were followed and the documentation is correct. – thrig Aug 17 '22 at 13:13
-1

I found a solution,

 echo "eval \"\$($(brew --prefix)/bin/brew shellenv)\"" >> ~/.zshrc

because of lack of knowledges i did it like that before :

~ » echo "eval \"\$($(brew --prefix)/bin/brew shellenv)\"" >> ~/.profile

so it was in .profile instead of .zshrc

Cheers

  • 1
    This seems to be a duplicate of the accepted answer, apart from writing to another file without reason. The line should really be in `~/.zprofile`. – Kusalananda Aug 18 '22 at 15:49