Problems building swift package on command line

Ran into an issue, where for some reason, on one of my Macs, XCode swift works fine, but on another, I got an error like:

$ xcrun --sdk macosx --find xctest
xcrun: error: unable to find utility “xctest”, not a developer tool or in PATH

Talking to my friend Christoph, he pointed out that I should run

$ sudo xcode-select -s /Applications/

sudo and touchID

Could have sworn I posted this before... This is easy, just modify /etc/pam.d/sudo like

root@sleipnir /opt/ats # cat /etc/pam.d/sudo
# sudo: auth account password session
auth       sufficient


Obviously make sure you leave all the other lines in there, or you are in trouble. In iTerm2, you also have to turn off the Advanced setting named

Prefs > Advanced > Allow sessions to survive logging out and back in



Running macOS in Dark Mode, but exclude a certain app

No doubt, Dark Mode is the best. However, there are still some apps that behave incredibly poorly, not properly detecting this. They should either turn off Dark Mode in their app, or fix their color schemes. However, there's a simple way to exclude one (or more) apps from the Dark Mode. Couple of options:

1) Edit the .plist for the app, adding tha ppropriate NSRequiresAquaSystemAppearance option

2) Run commands like the following (command line), in this case, I want to exclude OpenSCAD (whic his b0rken):

$ osascript -e 'id of app "OpenSCAD"'
$ defaults write org.openscad.OpenSCAD NSRequiresAquaSystemAppearance -bool YES




Drupal and upgrading PHP from v5 -> v7

I finally bit the bullet to upgrade PHP from v5.x to v7.2.x (v7.3.x is not yet supported by this version of Drupal). So, of course, it was a disaster, and nothing worked. I had to do a few things to get things up and running again.

First, it would not execute my .php scripts, rather, it would return them as text ... I ended up adding this to my httpd.conf:

<FilesMatch \.php$>
SetHandler application/x-httpd-php

Alright, so that helps! Now, of course, it's failing with a DSO error like

 [client] PDOException: SQLSTATE[HY000] [2002] No such file or directory...

Not particularly useful, but my friend Brian France helped me track this down. Turns out, for some reason my PHP is not finding the mySQL domain socket, even though it's in the default directory. I modifed my php.ini accordingly:

pdo_mysql.default_socket = /var/lib/mysql/mysql.sock
mysql.default_socket = /var/lib/mysql/mysql.sock
mysqli.default_socket = /var/lib/mysql/mysql.sock

Voila! Now the last thing I had to tweak with my installation was opcache, I still don't understand why this is not enabled and configured with sensible defaults in PHP by default. But, in my php.ini, I added




Modern gcc compiler on Travis CI

I recently needed to setup Travis CI for a little pet project I'm working on. However, my code requires C++17 (yeh, I'm nuts), and the compiler suite that comes with the various Travis images do not satisfy this. Long story short, there are ways around this, forcing the installation and activation of gcc8 on Xenial. Example:

dist: xenial
language: cpp
compiler: gcc

  - sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
  - sudo apt-get update -qq
  - sudo apt-get install g++-8 libstdc++-8-dev
  - sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-8 90
  - sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 90

install: autoreconf -if

script: ./configure && make -j4 && make test


Slow logins to Ubuntu 18.04 server

I recently setup a Ubuntu 18.04 server for CI and builds. Once setup, I had "ssh" sessions always taking 25s to complete, which seemed odd. Turns out, of course, this is a bloody timeout in dbus and systemd's interacting with such. Why, you may ask, would systemd be involved here? Well, it's because it's fucking stupid. that's why! The first indicator I had was, after tracing the ssh daemon, was this  gem in auth.log:

Mar 11 00:43:43 castafiore sshd[1519]: pam_systemd(sshd:session): Failed to create session: Connection timed out

pam_systemd eh? So, I edited the following files, removing the optional systemd lines:



#session    optional

Please systemd, when will you go back and just do the one thing you were good at, and supposed to do; replace init.d.

Disabling WiFi and Bluetooth on Raspberry Pi's

I have some Raspberry's that are on wired network, and obviously, WiFi is just unecessary. The best way to disable this that I've found is to add these two lines to e.g. /etc/modprobe.d/raspi-blacklist.conf:

blacklist brcmfmac
blacklist brcmutil

At this point, you probably want to turn off the Bluetooth services:

systemctl disable  bluetooth.service


Turning off tmpfs for /tmp and swap with systemd

systemd, by arch nemesis, strikes again. Now it wants to own various mount points, of course. This include /tmp, which is not good on boxes with little memory, like a Raspberry Pi. At least not when doing something serious. To turn this off, run

$ systemctl mask tmp.mount
$ systemctl disable zram-swap.service


Turning off spectre and meltdown protection in Linux

This is perhaps not the best thing to do always, particularly not in a desktop Linux system. But in my case, I have some machines that are inside a firewall, doing nothing but compiling software, and it generally doesn't run things that are unsafe or from the wild. Turning off these protections can give you significant performance improvements (well, returning to the old performance before Spectre). Here's what I did for my Fedora 29 boxes:

In /etc/default/grub, append:

GRUB_CMDLINE_LINUX="... quiet pti=off spectre_v2=off l1tf=off nospec_store_bypass_disable no_stf_barrier"

Then, re-run the grub2 command, in my case, since I'm on EFI, it's

grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg

Alternatively, you would run

grub2-mkconfig -o /boot/grub2/grub.cfg



Subscribe to RSS