Brandon Rozek

Photo of Brandon Rozek

Software Developer, Researcher, and Linux Enthusiast.

Zsh and Snaps

Published on

Updated on

In case I forget again, by default when snaps are installed it doesn’t populate in the zsh shell. To enable this add the following to /etc/zsh/zprofile

emulate sh -c 'source /etc/profile.d/'

In case you don’t have in /etc/profile.d/, then here’s the file as of this date:

# shellcheck shell=sh

# Expand $PATH to include the directory where snappy applications go.
if [ -n "${PATH##*${snap_bin_path}}" -a -n "${PATH##*${snap_bin_path}:*}" ]; then
    export PATH=$PATH:${snap_bin_path}

# Ensure base distro defaults xdg path are set if nothing filed up some
# defaults yet.
if [ -z "$XDG_DATA_DIRS" ]; then
    export XDG_DATA_DIRS="/usr/local/share:/usr/share"

# Desktop files (used by desktop environments within both X11 and Wayland) are
# looked for in XDG_DATA_DIRS; make sure it includes the relevant directory for
# snappy applications' desktop files.
if [ -n "${XDG_DATA_DIRS##*${snap_xdg_path}}" -a -n "${XDG_DATA_DIRS##*${snap_xdg_path}:*}" ]; then
    export XDG_DATA_DIRS="${XDG_DATA_DIRS}:${snap_xdg_path}"

Source: hackel on Ask Ubuntu.

Reply via Email

Have you published a response to this? :