How to install mate desktop in FreeBSD and localize it as Finnish locale

At first install some crucial packages via root prompt

pkg install pkg

pkg install sudo xorg xinit yad zenity xterm firefox pluma nano inxi lightdm lightdm-gtk-greeter

Enable lightdm in /etc/rc.conf to start at system boot:

sysrc lightdm_enable="YES"

echo "exec dbus-launch --exit-with-x11 ck-launch-session mate-session" > ~/.xinitrc

https://docs.freebsd.org/en/books/handbook/desktop/index.html

You need to edit groups, sudoers file, install graphick driver, set directories, set locales and set usb umount.

###################################################
#################### GROUPS ####################
###################################################

sudo pw groupmod video -m username

sudo pw groupmod wheel -m username

sudo pw groupmod operator -m username

sudo pw groupmod network -m username

sudo pw groupmod webcamd -m username

… Replace username with real username
###################################################
#################### SUDOERS #########################
###################################################

If not wanting to spend hours to teaching how to use vi editor, the best way is to install nano editor and use nano for editing sudoers file.

… run as root

pkg install sudo nano

sudo EDITOR=nano visudo

… comment out wheel and sudo lines like

## Uncomment to allow members of group wheel to execute any command
%wheel ALL=(ALL:ALL) ALL

## Same thing without a password
# %wheel ALL=(ALL:ALL) NOPASSWD: ALL

## Uncomment to allow members of group sudo to execute any command
%sudo ALL=(ALL:ALL) ALL

…. save and quit

###################################################
#################### GRAPHICKS ####################
###################################################

sudo pkg install inxi

pciconf -lv|grep -B4 VGA

inxi -Gx

sudo pkg install drm-kmod

sudo nano /etc/rc.conf

sysrc kld_list+=i915kms ## intel

sysrc kld_list+=radeonkms ## amd

More settings from https://docs.freebsd.org/en/books/handbook/x11/

############################################

My /etc/rc.conf


hostname="dc7700"
keymap="fi.kbd"
wlans_run0="wlan0"
ifconfig_wlan0="WPA DHCP"
moused_enable="YES"
# Set dumpdev to "AUTO" to enable crash dumps, "NO" to disable
dumpdev="NO"
sysrc dbus_enable="YES"
dbus_enable="YES"
sysrc lightdm_enable="YES"
lightdm_enable="YES"
fusefs_enable="YES"
sysrc kld_list+=i915kms
kld_list="i915kms"
ifconfig_em0="DHCP"
webcamd_enable="YES"
sysrc linux_enable="YES"
linux_enable="YES"
devfs_load_ruleset="YES"
devfs_rulesets="/etc/devfs.rules"
devfs_system_ruleset="localrules"
ntpd_enable="YES"
kld_list="fuse"
kld_list="fusefs"
kld_list="/boot/kernel/fusefs.ko i915kms"

###################################################
#################### DIRECTORIES #################
###################################################

To get directories, you need to run a commands

sudo pkg install xdg-user-dirs xdg-utils

xdg-user-dirs-update

… after running xdg-user-dirs-update, take it off from startup applications.

My ~/.config/user-dirs.dirs file

# This file is written by xdg-user-dirs-update
# If you want to change or add directories, just edit the line you’re
# interested in. All local changes will be retained on the next run.
# Format is XDG_xxx_DIR=”$HOME/yyy”, where yyy is a shell-escaped
# homedir-relative path, or XDG_xxx_DIR=”/yyy”, where /yyy is an
# absolute path. No other format is supported.
#
XDG_DESKTOP_DIR="$HOME/Työpöytä"
XDG_DOWNLOAD_DIR="$HOME/Lataukset"
XDG_TEMPLATES_DIR="$HOME/Mallit"
XDG_PUBLICSHARE_DIR="$HOME/JUlkinen"
XDG_DOCUMENTS_DIR="$HOME/Asiakirjat"
XDG_MUSIC_DIR="$HOME/Musiikki"
XDG_PICTURES_DIR="$HOME/Kuvat"
XDG_VIDEOS_DIR="$HOME/Videot"

My ~/.config/user-dirs.locale file

fi_FI

###################################################
#################### LOCALES ####################
###################################################
To determine the current locale setting:

locale

To add or edit locale

nano ~/.login_conf

… my contents (Finnish locale)

# see login.conf(5)
#
me:\
:charset=UTF-8:\
:lang=fi_FI.UTF-8:\

… after editing reboot


#############################################################
## ~/.profile file determines user locale ##
#############################################################
EDITOR=nano; export EDITOR
PAGER=less; export PAGER

# set ENV to a file invoked each time sh is started for interactive use.
ENV=$HOME/.shrc; export ENV

# Let sh(1) know it's at home, despite /home being a symlink.
if [ "$PWD" != "$HOME" ] && [ "$PWD" -ef "$HOME" ] ; then cd ; fi

# Query terminal size; useful for serial lines.
if [ -x /usr/bin/resizewin ] ; then /usr/bin/resizewin -z ; fi

# Display a random cookie on each login.
if [ -x /usr/bin/fortune ] ; then /usr/bin/fortune freebsd-tips ; fi

# Set default locale
CHARSET=UTF-8; export CHARSET
LANG=fi_FI.UTF-8; export LANG

Finnish settings in one script

Finnish-settings.zip

#!/bin/sh

mkdir Työpöytä Asiakirjat Kuvat Musiikki Videot Lataukset Julkinen Mallit

sleep 1

mv Desktop Työpöytä
mv Downloads Lataukset
mv Templates Mallit
mv Documents Asiakirjat
mv Music Musiikki
mv Pictures Kuvat
mv Videos Videot
mv Public Julkinen

sleep 1

sed -i '''s/Desktop/Työpöytä/g' $HOME/.config/user-dirs.dirs

sed -i '''s/Downloads/Lataukset/g' $HOME/.config/user-dirs.dirs

sed -i '''s/Templates/Mallit/g' $HOME/.config/user-dirs.dirs

sed -i '''s/Documents/Asiakirjat/g' $HOME/.config/user-dirs.dirs

sed -i '''s/Music/Musiikki/g' $HOME/.config/user-dirs.dirs

sed -i '''s/Pictures/Kuvat/g' $HOME/.config/user-dirs.dirs

sed -i '''s/Videos/Videot/g' $HOME/.config/user-dirs.dirs

sed -i '''s/Videos/Videot/g' $HOME/.config/user-dirs.dirs

sed -i '''s/C/fi_FI/g' $HOME/.config/user-dirs.locale

echo "CHARSET=UTF-8; export CHARSET" >> ~/.profile # check profile file after that
echo "LANG=fi_FI.UTF-8; export LANG" >> ~/.profile # check profile file after that

###################################################
############## USB UNMOUNT ####################
###################################################

Edit 29.6.2025: The solution is there -> https://puolanka.info/goto/usb-mount-and-unmount-in-freebsd/

I have not find how to unmount USB-devices as regular user, but the next script may help you

#!/bin/sh
#
# RJP 24.6.2025 USB unmount script
# Packages sudo, xterm and yad must be installed
#
#
mount > /tmp/mount.txt
yad --center --width=700 --height=200 --text-align=center --title="MOUNTED DRIVES" --text="INFO: $(cat /tmp/mount.txt)"
yad --text="Would like to unmount USB?" --title="QUESTION"
if [ $? = 0 ];
then
/bin/sh -c "xterm -e 'sudo umount /media/da0*'&& yad --center --borders=5 --width=400 --text-align=center --button=ok:1 --title='USB should be unmounted' --buttons-layout=center"
else exit 0
fi
sleep 1
rm /tmp/mount.txt

my installed-packages.txt.zip

USB-UMOUNT script.zip