7

When I restart my PC I get this error:

Error found when loading /home/ray/.profile:

/home/ray/.profile: line 28: /bin/brew: No such file or directory

As a result the session will not be configured correctly.
You should fix the problem as soon as feasible.

As far as I can understand it's the installation of homebrew that is causing this issue because it says /bin/brew in the second line and I wasn't getting this issue on boot-up before I installed homebrew. After some research I found that homebrew isn't really for Ubuntu, just MacOS. If I remember correctly on how I installed homebrew I did it this way:

sudo apt-get install build-essential curl file git
sh -c "$(curl -fsSL https://raw.githubusercontent.com/Linuxbrew/install/master/install.sh)"
echo 'export PATH="/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin/:$PATH"' >>~/.bashrc
echo 'export MANPATH="/home/linuxbrew/.linuxbrew/share/man:$MANPATH"' >>~/.bashrc
echo 'export INFOPATH="/home/linuxbrew/.linuxbrew/share/info:$INFOPATH"' >>~/.bashrc
source  ~/.bashrc

Any help is appreciated. I actually don't mind uninstalling homebrew if that's what's necessary, in fact that's what I would like to do once I resolve this error message on bootup.

Pablo Bianchi
  • 17,552
RayGar
  • 71
  • It's not "I must fix A before addressing B." B is causing A. Removing B fixes A. – user535733 May 29 '20 at 14:29
  • So are you saying that uninstalling homebrew will fix the issue being sent by the message? – RayGar May 29 '20 at 15:38
  • Yes, if you do a thorough job uninstalling. – user535733 May 29 '20 at 15:39
  • I uninstalled homebrew as I've seen recommended by some other posters using this script . I also deleted the additional directories that the script's command line interface suggested to delete but when I booted again I still got the error. – RayGar May 29 '20 at 17:13
  • Not thorough. Your original install, according to your Question above, changed your ~/.bashrc three times and your ~/.profile too. You need to undo those changes. Bit of a mess Brew makes, eh? Do you know how to use a plain old text editor? (not word processor) – user535733 May 29 '20 at 17:26
  • I've never had to configure any environment variables in Ubuntu up to now. I'm trying to edit ~/.bashrc as you've suggested but I'm at my wit's end being a noob. In Terminal I've researched how to show environment vairables and I can see PATH was changed with brew's installation when I run printenv. Would you explain to me how to undo the changes to ~/.bashrc and ~/.profile I suppose with Ubuntu's default Text Editor? – RayGar May 29 '20 at 18:22
  • Open the files in Gedit (Text Editor). Scroll to the elements that are related to Brew (you detailed them in your question). Delete. Save. If you need more help than that, edit your question to show the final ten lines of ~/.bashrc and line 28 of ~/.profile. These are easy edits because you own the files (no need for sudo). – user535733 May 29 '20 at 19:23
  • this has solved my issue. Thank you so much! – RayGar May 31 '20 at 16:38

2 Answers2

10

I had also the problem when I tried installing Homebrew and terminated it halfway. Then whenever I start ubuntu, this error pops up. Then I tried a method to fix it and it worked correctly.

The Solution is

Simply delete the line containing eval $(/bin/brew shellenv) from /home/ray/.profile file.

-1

In my case was same error.

I removed the line containing eval $(/bin/brew shellenv) from the /home/$USER/.profile file and the error went away.

Where $USER is the profile username.

Pablo Bianchi
  • 17,552