Skip to content

Instantly share code, notes, and snippets.

@tehpeh
Last active February 11, 2023 17:52
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tehpeh/5459642e2987defa452f62b45741fea5 to your computer and use it in GitHub Desktop.
Save tehpeh/5459642e2987defa452f62b45741fea5 to your computer and use it in GitHub Desktop.

So it's been a while since I set up a #FreeBSD desktop from scratch, and things have gotten easier? :rising-intonation: :confused-dog-face: Curious? Read on!

Maybe I overcomplicated things last time (you can see the script here https://bit.ly/freebsd-bootstrap), it seems some steps are now redundant. Anyway, here's the simplest way I know to get a capable desktop system set up.

I'm doing this on an M1 Mac with VMware Fusion Tech Preview and FreeBSD 13.1-RELEASE. After (or during) install create a user and add it to the groups video, wheel and operator with

% pw usermod $USER -G wheel,operator,video

Now install the packages for a desktop environment. For simplicity and speed (and because I like it) I'm going with Xfce, but LXQt also works. Switch to root and run

% pkg install xorg xfce lightdm-gtk-greeter

As I'm on VMware I'll also run

% pkg install open-vm-tools

Then set some sensible defaults. The Fusion Tech Preview uses a USB mouse, and doesn't yet handle resolution switching so we'll force something reasonable. Edit ee /boot/loader.conf and add

ums_load="YES"
efi_max_resolution="1680x1050"

Exit and save. Source https://communities.vmware.com/t5/Fusion-for-Apple-Silicon-Tech/FreeBSD-13-1-and-mouse-support/m-p/2914762

More config: Run

% sysrc dbus_enable=YES lightdm_enable=YES ntpd_enable=YES ntpd_flags=-g

My VM needs

% sysrc vmware_guestd_enable=YES

For faster boots we'll add

% sysrc background_dhclient=YES sendmail_enable=NONE

Switch back to your normal user with exit and set your language and time zone. There are a couple of ways, but we can do it in one go by editing ee .xprofile and adding the lines

export LANG="en_US.UTF-8"
export LC_CTYPE="en_US.UTF-8"
export TZ=":Australia/Sydney"

If I've remembered everything, that's about the minimum to get a decent, lightweight desktop environment set up. Reboot and you should get a GUI login prompt. From here you can add some apps like pkg install firefox.

Normally I'd mess around with devfs.conf, vfs.usermount=1, and dsbmc to get external disk mounting to work, but it seems to work in Xfce without it, so plug in a thumb drive and see what happens!

Did you know you can run many Linux binaries too? Enable Linux compatibility with sysrc linux_enable=YES and try out pkg install linux-sublime-text4. This now seems to mount the necessary Linux proc, tmp, and sysfs filesystems, so one less step to worry about there.

BONUS ROUND! The default setup of Xfce reminds me a bit of good ol' Mac OS 8/9, let's nudge it along.

Open the Settings Manager, and under Appearance select the Greybird theme. In Window Manager you can move the window title buttons to the left, and under Desktop set icon orientation to "Top Right Vertical".

Replace the default top-panel application menu with pkg install xfce4-whiskermenu-plugin and thanks to @vermaden we know how to move to a global menu with pkg install xfce4-appmenu-plugin, then follow the post-install message. Source https://vermaden.wordpress.com/2022/02/09/xfce-cupertino-way/

Aside: Bare metal installs will need a video driver. For Intel and AMD pkg install drm-kmod and sysrc kld_list+=i915kms or sysrc kld_list+=amdgpu respectively. For Nvidia pkg install nvidia-driver and sysrc kld_list+=nvidia-modeset.

If I've missed anything I'll add to the gist. Feedback and questions welcome :) Thanks for reading.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment