zsh and /etc/profile
I just upgraded from zsh v5.5 to zsh v5.9 and some of my applications broke.
It seems the environment variable
$XDG_DATA_DIRS was blanked out in the process.
$XDG_DATA_DIRS holds the location of directories which can contain
.desktop files are basically application shortcuts in the Linux desktop world.
$XDG_DATA_DIRS and several such variables are initialized by scripts placed in
/etc/profiles.d folder. This folder is executed by the
Now, the twist is that the
/etc/profile is only invoked by bash shell
zsh uses its own set of configuration files:
Most modern distros will have a mechanism where in /etc/zsh/zprofile will invoke the
/etc/profile which in turn will invoke all the scripts placed inside
However, if you are using the older distro or a non-Desktop distros such as CentOS, RedHat, this might not be the case.
In that case, you need to setup that linkage manually. In my case, I created the file
/etc/zsh/zprofile with the contents
emulate sh -c 'source /etc/profile'
One other thing I found that some distros might invoke
/etc/zprofile , instead of
In that case, you might want to symlink the files with
sudo ln -s /etc/zsh/zprofile /etc/zprofile