Mac-like FreeBSD Laptop

This is a tour of my FreeBSD laptop. I’ve set a goal of configuring a Unix laptop with focused and efficient user interface, suitable for all sorts of office work, research and entertainment tasks. My point of reference for this machine is the 13-inch Retina MacBook Pro 2015 and Jobs-era MacOS versions, on which my choices of user interface elements are mainly based.

This is a work in progress. I am not a programmer or a systems administrator, hence, this post is a user’s perspective which may be of interest to others considering FreeBSD or another open source OS for their daily desktop use and are coming from the Mac background. I will occasionally update this page with the latest information.

FreeBSD, imitating a Mac.
System Configuration

At the current moment this is a Lenovo ThinkPad X1 Yoga laptop with Intel Core i7-6600U 2.60 GHz CPU (Skylake), 8 GB RAM, 512 GB SSD, and Intel HD Graphics 520 integrated graphics adapter. It features a 14″ WQHD 2560 x 1440 touchscreen with Retina-like density of 210 dpi. In some ways this is similar to a 13-inch MacBook Pro, except that the tactile sensation is smooth plastic instead of aluminum, and it’s much lighter. ThinkPads are known to be one of the traditional choices of laptops among FreeBSD users, providing some degree of certainty in terms of driver support.

Lenovo ThinkPad X1 Yoga (1st generation). Pardon me for this unrepresentative and beaten up Ikea table.

An external monitor (24″ Apple Cinema Display, 1920 x 1200 with a lower DPI) on my work place is occasionally connected via Mini DisplayPort to the ThinkPad. My custom script monitors connections and switches resolution, scaling and mouse sensitivity, from touchpad to a USB mouse and back, every 2 seconds. This emulates seamless transition between externally connected and internal display and input devices on a MacBook Pro.

In the office I have Canon Pixma MG4200-series printer, and FreeBSD prints to it without problems via wireless connection. The printer is setup in the CUPS (Common Unix Printing System), connected via LPD protocol. There is little difference from Mac here asides from the peculiarity of adding, removing or configuring printers via http://localhost:631.

 

System Environment and Command-Line Interface

My command-line interface shell of choice is the Z shell (zsh), which is an extended Bourne shell. It is not a principal choice – its place can be occupied by bash or other shells, which FreeBSD provides aplenty. Start-up daemons and other parameters are configured via the /etc/rc.conf configuration file, and daemons can also be managed from the command line using the service command, similarly to Mac’s launchctl. The laptop runs SSH, NTP and FTP daemons by default, as well as other auxiliary services.

Terminal showing running services, Thunar file manager and Xfce desktop environment settings window.

FreeBSD features Linux binary compatibility layer (Linuxulator), so certain Linux utilities can be run without modifications. Windows executable compatibility is available via Wine, although not all applications work seamlessly. I’ve successfully debugged a Linux ELF executable using Windows version of IDA, and ran it then on FreeBSD without modifications.

 

Backups, System Migration and Upgrades

The whole UFS root file system is backed up every hour via rsync script, triggered by cron. The target backup host – the equivalent of Apple Time Capsule – is a Raspberry Pi with USB-connected hard drive. My custom script checks if an rsync process is already running before initiating hourly backup session, and it maintains a log of backups which is displayed every time I open a terminal. The whole system can be restored using rsync. It is possible to use ZFS snapshots and implement a better snapshot-based backup mechanism, providing virtually the same functionality as the Time Machine on a Mac. I also backup ~/.config once per day. Unlike with a Mac, you can customize virtually anything in the GUI, so it’s useful to have a configuration backup, especially for Xfce elements.

Migrating the system to other hardware is possible. With rsync-based backups this would involve installing the same version of FreeBSD from the installation medium (usually a USB drive), which only takes a few minutes to get to the base installation with shell prompt, and then doing rsync to copy files over from the backup drive. The fact that FreeBSD draws a hard line between the base operating system and the user applications (installed and configured under /usr/local) simplifies management grealy. Rigid, conservative approach to the file system hierarchy is one of the reasons I enjoy FreeBSD .

Operating system upgrades are done via the freebsd-update command-line utility which is properly documented in the FreeBSD Handbook, included with the operating system. An upgrade of a major version of the operating system will trigger the necessity to upgrade all the binary packages installed. With approximately 1,200 packages this results in about 3 GB download, all done by a single pkg upgrade command. My general approach would be to wait for the second minor version revision until I do a major upgrade.

 

Graphical User Interface

The GUI on my FreeBSD laptop is Xfce4 with Compton, replicating MacOS experience as much as possible. I’ve modified the Enso 0.3 theme by rescaling graphical elements to 130% to match Retina-like resolution of the ThinkPad’s high-density screen. I’ve also recolored window buttons, as I prefer monochrome decorations more than tri-color.

The Xfce session is initiated with xcalib and a matching ICM file for proper color calibration. The X Windows server has been configured with disabled pixmap fonts, to ensure proper font rendition on web sites, and, also, to enable SNA acceleration on the graphics card and ThinkPad’s touchscreen functions via the evdev driver.

All application icons come from Macbuntu, available for download online, and the docker is Plank, running OSX Lion theme. Xfce’s Whisker menu is the equivalent of Mac’s application stack in the dock. The Whisker menu is launched by the Beastie icon that fits nicely to the right of the dock. Application search is available in the whisker menu itself. I’ve decided not to invest time trying to find a tool replicating Apple’s top menu. Next to the Beastie is the indicator of the file system mount points, and, also, the battery level indicator.

Keyboard window control, which is handled by Spectacle on a Mac, is now done by the Xfce window manager itself. No additional applications are required. For example, Ctrl+Alt+Left commands the window to occupy the right half of the screen, however, for Ctrl+Alt+Right I have a custom script that relies on wmctrl to snap the window to the right screen border, maximize vertically and resize it to fill 2/3 of the screen’s width. For Ctrl+Alt+C (center), another script centers the window, resizes it to 4/5 of screen and, also, maximizes it vertically. This allows to arrange windows quickly on screen for document and code comparison, filling forms, and other tasks. Ctrl+Alt+F (full-screen) maximizes the window.

Similarly to a Mac, Alt+Tab switches between applications quickly, however, I also employ skippy-xd for task switching in Expose-like manner. brightside is used for its activation via hot corners. I’ve had to modify skippy’s source code for it to work on dual monitors with different resolutions, however, I’ve submitted a comment to the author, so hopefully this will work in the next release.

The window file manager on the system is Thunar. It provides basic functionality of Finder, however, for file manipulation I prefer Double Commander, which is an excellent implementation of a dual-pane file manager I’ve got used to since PC/XT and the Norton Commander era. Albeit being in beta and still having a way to go to be rock-solid, Double Commander is really powerful stuff. I really enjoy the quick filter feature, as my working directory has more than 50,000 files, and I can simply type whatever I want to find and seep through the hierarchy to find that little file I forgot even how it was called. I made it look primitive deliberately by turning toolbars off, but there’s tons of stuff in it, and it’s very configurable.

Double Commander – dual-pane file manager with a GUI.

For quickly finding working files among thousands of folders, Xfce’s Desktop Search replaces Spotlight perfectly. For visualizing free disk space, I’ve got used to SequoiaView and it’s lookalikes on Mac, and on FreeBSD QDirStat is the tool for that. I’ve always had that paranoia something big is lurking somewhere in /usr, but, alas, too lazy to remember the du syntax.

QDirStat visualizing disk space usage.

 

Basic Applications

Most of the applications I use on MacOS are available on FreeBSD. All applications are binary versions, installed via pkg from FreeBSD repository. Almost nothing is compiled from scratch. The only exception is the drm-stable-kmod – the driver for the laptop’s graphics card – which is easy to build and install from ports.

A number of third party applications replaces standard MacOS GUI utilities. Galculator replaces Mac’s desktop calculator widget which I use a lot for back-of-the-envelope stuff. I’ve found its paper mode, unavailable on Macs, to be quite useful, as it allows to track history.

Those apps are pretty much a drop-in replacements:

TextEdit: Mousepad
Terminal: Xfce Terminal
Activity Monitor: Xfce Task Manager
MacOS Screenshots: Xfce4 Screenshot
Unarchiver: Xarchiver
Quicktime: VLC
Font Manager: Gnome Font Manager

Ristretto is what I mainly use instead of the Preview, although it can’t read PDFs and do basic manipulation with images, which Preview does very well. For basic file conversions and resizes there are ImageMagick convert and mogrify command-line commands, and, of course, a full-blown graphics editor can always be used for that. For PDFs, Evince, Xournal and Okular are available, which render all the documents, even the most complex ones, without problems, although they also lack manipulation capabilities which I use a lot in Apple’s Preview. Xournal and Okular can do stamps or overlay transparent PNG images to sign PDFs, though.

I have found FreeBSD’s wifimgr, despite it’s somewhat peculiar interface, to be a better replacement of Apple’s built-in Wi-Fi manager, as it provides more detailed information on wireless channels, connection speeds and allows to manipulate network priorities.

Xfce Mixer replaces Apple’s built-in audio mixer, and HexChat is the IRC client of choice instead of Limechat. For torrents, I use rtorrent.

FreeBSD’s Wi-Fi Manager, Ristretto image viewer and audio mixer.
Work

I spent my work hours writing e-mails and working with standard office suite apps. FreeBSD laptop is fully identical to Mac here – the LibreOffice suite is available on FreeBSD. Font render quality is on an exceptional level. Perhaps an illusion or bias, but I prefer FreeBSD’s font rendering on WQHD to Apple’s Retina, especially on serif fonts.

I’m using Thunderbird on both operating systems to work with e-mails. The new Firefox Quantum is very efficient on resources and requires little introduction. Web-based Lucid Charts is my go-to application for network, process and other diagrams – on both Mac and FreeBSD laptops.

Office suite on a FreeBSD – LibreOffice Calc and Writer.
Education and Scientific Research

For research tasks, FreeBSD provides a wealth of applications, and it is also in many ways similar to Mac. FreeBSD repository hosts TeXLive, upon which MacTeX itself is based. Installation is as straightforward as installing the full TeX environment on a Mac. My preferred editor is TeXWorks, which is quite similar to TeXShop. BibDesk is replaced by JabRef. There are two ways to enter special characters, such as umlauts, em- and en-dashes, and so on. First is to use what’s called compose key that can bet set up in Xfce keyboard settings. The Windows key is what I currently use. Pressing Win+oo results in a degree sign, and so on. The second way is to use Ctrl+Shift+U, followed by the unicode. There are cheat sheets available for both compose keys and unicodes.

For C++ programming, Qt Creator is available in the repository, and R is also there for statistical computing. Of course, Python and Java, as well as any other programming language imaginable are available. Using Java applications like TOPCAT for manipulating astronomical catalogs and tables, is no different from a Mac. For manipulating astronomical images, the golden standard – PixInsight from Pleiades Astrophoto S.L. – is available natively of FreeBSD. I admire author’s decision to support this platform.

 

Graphics Manipulation

Although Adobe Photoshop is not available for FreeBSD, the CS6 version works reasonably well under Wine emulation, albeit not scaling UI correctly for high-density display. There’s always GIMP, and Krita is becoming increasingly more powerful, and provides most of the Photoshop functionality without inducing interface panic.

ThinkPad’s touchscreen works under FreeBSD, so X1 Yoga becomes a Wacom drawing tablet with Krita, however, to tell how well that specific function performs is beyond my qualification. It is important to mention that FreeBSD and Krita recognize pen pressure, and I couldn’t notice any difference in experience, compared to drawing on a stand-alone Wacom tablet running Windows 10.

Krita as a Photoshop replacement.

For vector graphics, there’s Inkscape that can read Adobe Illustrator files.

Missing Applications and Other Difficulties

Some of the work I do involves manipulating brochures. Unfortunately, QuarkXpress is not available on FreeBSD. I’ve got the 9th version to run under Wine with a few quirks, however, couldn’t get it to print PDFs, as it produces blanks. Scribus is the open source DLP software, however, it does not import QXP files – actually very little other software can. Perhaps, it’s time to redesign everything using Scribus. I’ve found it provides similar functionality in a stable environment.

There’s no Skype client available for FreeBSD, so I’m running its Web version in Chromium, launched from the dock. At the moment of writing this, it does not support videoconferencing, although both ThinkPad webcam video and audio are working fine. Audio conferencing works though.

ThinkPad’s touchpad behaves differently from Mac’s – I still can’t get Firefox smooth scrolling to work right, and I don’t know how to set up gestures, e.g. three-finger swipe as the back and forward actions in Safari. Alt+cursor runs that function for me at the moment. I couldn’t get Bluetooth to work, but I’m probably going to ditch wireless keyboard and mouse anyways (not a fan of charging batteries.) For externally connected keyboard, I’m going with the small Lenovo ThinkPad compact keyboard that has form similar to Apple’s compact keyboard.

One the major issues with FreeBSD is the complex web of dependencies of user applications and installed tools and libraries. While MacOS applications are based on application bundles – an idea probably stemming from the NeXT era – that usually pack most of the software they depend upon, FreeBSD relies on shared libraries. That is, a major upgrade of, let’s say, Firefox can trigger an upgrade of hundreds of other library packages installed which, in their turn, may trigger a forced upgrade of completely unrelated software. Upgrade a PDF viewer and end up with a new e-mail client… Hence, in order to stabilize a working desktop environment in FreeBSD one must be exceptionally careful about upgrading just about anything. If a user can be satisfied with upgrading the whole environment in sync with the base operating system then this shouldn’t cause problems, although still requires more planning than I’d prefer, and I certainly want to avoid upgrades in the middle of a semester or during a complex project.

 

Conclusion

Within the context of my daily desktop tasks, FreeBSD-running ThinkPad X1 Yoga subjectively performs as fast as a MacBook Pro of an equivalent generation, if not faster. There are no freezes, reboots or other disturbances. Sleep and resume functions work seamlessly. The battery life is about 4-5 hours, depending on the task, which is not as good as the MacBook Pro, however, still quite satisfactory. Perhaps, there is a potential to improve battery life via power management tweaks.

Traditionally used on servers, FreeBSD is a solid operating system for laptops. It’s a system that is highly configurable, resource-efficient and is capable, once properly adjusted, of delivering exceptional graphical user experience. It performs in a predictable manner and features excellent documentation – both manual pages and the FreeBSD Handbook. While you can get most of that on a Mac out of the box, you need to configure everything from scratch in FreeBSD, and that’s part of the experience.

This example is not intended as a guide, rather than an illustration that a Mac user can feel at home on FreeBSD and third party hardware. FreeBSD, configured that way, is to a much higher degree closer to Mac experience than Windows, and possess that quality when the GUI “disappears” and lets you work with applications at full focus. And, oh, yeah, my maximize window button does what it is supposed to do! If you are looking for a FreeBSD desktop how-to then I would highly recommend to start with Allison Nicole Reid’s page.

 

Post Scriptum

Why am I doing it? The same reason I drive motorcycle while having a SUV with fine leather seats in the garage. The feeling of warm engine and the gears working, the sound, the immediate feedback from the road… So much acceleration, and exposure to elements. Gloves on, sun shining through the visor in the morning – makes me feel alive. Perhaps, the reason I am typing this on a FreeBSD laptop is irrational. Or, perhaps, not. I find it important to keep the Unix light glowing, especially as Linux sails further away. It’s also about having a sense of freedom to choose your own hardware, and not being dependent on a single company to have exceptional GUI experience. If anybody’s still reading, I wish you best of luck building your own BSD machine. I think the time has never been better.