Too easy to break Gnome using just .bashrc

Using Homebrew eval or something like export PATH=: in .bashrc completely breaks the Gnome GUI, including flatpaks like Geary. Commenting out default .bash_profile(GDM?) seems to prevent these overrides. I wonder if others share similar experiences or thoughts on this.

1 Like

Don’t use tools that alter stuff you aren’t expecting :stuck_out_tongue:

I’ve used GNOME for years, probably never touched .bashrc and never had anything break it, but it’d only be edited with nano if I needed to.


I don’t know what brew is doing in that case but I don’t see an obvious reason to be doing anything with shellenv there on the assumption that the distro package manager should have handled that?

3 Likes

It makes Homebrew binaries takes precedence on PATH, but I assumed this would never translate to GUI environment. I will need to take a better look on the workings of rc and profile shell files.

1 Like

Added atomic-desktops, bash

Homebrew is not supported by Fedora particularly, even though it may be one great way to get pretty centralized binaries that are in OCI containers.

I agree that Atomic Desktops are very very breakable if you do wrong things.

~/.bashrc sources the default config from /etc/ and I would be a fan of not using the home bashrc at all.

1 Like

Added homebrew

PATH is PATH, regardless of whether you are in GUI or console mode.

1 Like

Its almost never correct to change PATH in .bashrc, put these changes into .bash_profile.

What you did ensured that almost every thing that uses bash will break.

2 Likes

GNOME will invoke user’s default shell as login shell to do some initialization stuff and all processes afterwards in a session will inherit the env variables defined by the login shell.

Maybe you can define the PATH variable conditionally on an interactive shell but not for a login shell, or put the definition in a file that only the interactive shell will read.

Note that while bash reads ~/.bash_profile as a login shell and reads ~/.bashrc as an interactive shell, ~/.bashrc is also sourced by default ~/.bash_profile:

# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
    . ~/.bashrc
fi

So putting PATH in ~/.bashrc is not enough, you also need to comment out this snippet.

2 Likes

There’s a workaround to set it only for interactive terminals. This way things in brew’s path only apply when you open a terminal and don’t interfere with the system.

5 Likes

Thnx. I actually started using Homebrew after reading your discussions about it on the Bluefin issue tracker and on a blog post, where I criminally ignored the part that mentions this .

2 Likes