To regenerate the “open with” context menu in macOS (and reopen Finder windows), execute the following two commands in Terminal:
$ /System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -kill -r -domain local -domain system -domain user
$ killall Finder
Recently, the SystemUIServer process on my MBP running macOS Sierra has started “eating” a lot of CPU, slowing down the whole machine, even making the clock in the top menu bar stop working properly. It usually started using one-digit percentages of the available CPU power, then growing to 10%, 15%, 20%, up to well above 60%, sometimes even 80% and more! It wasn’t a steady growth – it sometimes shrank again, just to grow even further.
The only apparent remedy was to kill the SystemUIServer process (e.g. using the Activity Monitor) from time to time (i.e. every 30 minutes -> there are also scripts to automatically restart SystemUIServer). Its CPU usage then reset to a low one-digit number.
Taking a closer look at the process in the Activity Monitor, I then noticed that the number of (used) ports (so-called “Mach ports“) by the process were steadily growing, once SystemUIServer was started. This was weird, pointing to some kind of leakage. Typically, for a CPU load of around 50%, more than 5000 Mach ports were used.
By coincidence, I then noticed that, unlike expected, my MBP wasn’t actually using Ethernet, but only WiFi. Further investigation then hinted that the according Gigabit Ethernet port on my HP 1810 switch was apparently malfunctioning (or even dead): In the macOS Network Preferences, the Thunderbolt-Ethernet connection was constantly shown as red/disconnected, although the OS was apparently trying to establish a connection again and again (and failed). First, I even suspected a problem with the Thunderbolt-Gigabit-Ethernet adapter itself (it wasn’t the problem here, the adapter seemed to work fine with another Mac and connection).
The solution to this problem thus was:
- Connect the Ethernet cable to another, working Ethernet port: Now the SystemUIServer process consumes less than 0.1% CPU again and roughly 400 ports only, both with and without additional WiFi.
Note that both the problem and this solution are reproducible.
- Sometimes, very unexpected, seemingly unrelated and “small” problems can have big (negative) effects.
- Sometimes you need a bit of luck to find the cause of a problem (a web search didn’t bring up the above hint, rather suggested updating or removing faulty apps, buggy extensions and menu widgets. I thus already tried removing or updating some of the suspected apps, extensions and widgets.)
- Ports of HP 1810 switches can actually break/fail! Remember the saying: “I got 99 problems, but a switch ain’t one!” – well, in this case, the faulty switch was actually part of the problem and even the initial trigger of the problem! Also remember that HP offers a lifelong warranty on its (good ol’) 1810 switches.
- Extra points for you, further research: The fact that the SystemUIServer allocates more and more Mach ports if there’s a malfunctioning Ethernet port (i.e. faulty Ethernet connection or faulty handling of a faulty Ethernet connection by the Thunderbolt-Gigabit-Ethernet adapter) is hinting that this might be an attack vector for a (new?) DoS attack. Perhaps not an easily exploitable one (on the Ethernet or MAC layer, even), but it’s nonetheless something that should actually be handled gracefully by SystemUIServer, not leading to more and more CPU and system resources being consumed.
If you have time to research this further, let me know about your findings!
With the recent changes in Skype, the “traditional” method of running several Skype instances using different system users doesn’t work anymore (as the the new authentication dialog strangely doesn’t get the focus anymore).
So, in order to use several Skype accounts on macOS (formerly known as Mac OS X), do the following:
- Open the Script Editor (in the ‘Utilities’ folder in the ‘Applications’ folder)
- Create a new script with the following content:
do shell script "open -na /Applications/Skype.app/Contents/MacOS/Skype --args -DataPath '/Users/your_system_user/Library/Application Support/Skype_any_identifier'"
Replace your_system_user by your regular macOS user account (see ‘whoami’ in Terminal)
Replace _any_identifier by the according Skype account name, e.g. _myskypename (doesn’t really matter what, just don’t use an empty string)
Please mind the double quotes and single quotes (important!)
- Save the script as an application: File.. Save.., choose “Application” as file format, give it a name and store it e.g. in your home directory or in the Applications folder
Repeat these steps for any of your Skype accounts, giving each Skype account a different Skype_any_identifier. You can then start the according Skype instances by double clicking on the according app.
The above script starts a new instance of Skype (which would otherwise be prevented), using the -n argument. Each instance of Skype gets its own directory to store the according account data, using the -DataPath argument.
Karabiner allows to customize almost any aspect of the keymap on Mac OS X in a convenient way:
Karabiner – A powerful and stable keyboard customizer for OS X. (formerly known as KeyRemap4MacBook)
For example, you can make the “Home” and “End” keys behave like on a PC. Regarding these two keys, I find the PC style behaviour more intuitive, e.g. using shift-home and shift-end to select text, rather than using the tricky three-finger-combinations shift-cmd-left_cursor and shift-cmd-right_cursor in Mac OS X.
Here’s how to configure this in Karabiner:
Further, I decided to lower the “Key Repeat Delay Until Repeat” to 100 ms and the “Key Repeat” to 23 ms for quicker navigation and repetitive typing.
Of course, there are many other useful tweaks to explore.
On hacker news (i.e the better alternative interface http://hckrnews.com), I stumbled over two nice helper apps for Mac OS X:
FinderPath (free) shows the full path in the title bar of a Finder window upon double-clicking it. Like that, the full path can be selected and copied to the clipboard or one can simply edit the path and hereby easily navigate through the filesystem trees. It’s quite a time saver!
HyperDock (9.95 USD) displays thumbnail screenshots of all windows of the running apps in the Dock when hovering over them, making it easier and quicker to switch to other windows or to close them (the latter being a feature still missing in Mission Control). It also supports several other cool features, like Window Snapping.
Just a note that I updated the t-prot.rb Homebrew formula for t-prot 3.3 (it’s really trivial, just a version bump). See my original post for the updated formula.
In a current LUGS mailing list thread, mowgli pointed to the t-prot script as a nice tool to “fix” the so-called (and very common) TOFU style message quoting and some other annoyances (like commercial webmail provider signatures, overly excited !!!! statements, etc.) in e-mail messages. t-prot was originally developed for mutt, but can also be used with other mail clients.
As there wasn’t any t-prot package for my favourite Mac OS X package manager Homebrew yet (apparently only for MacPorts), I quickly created one myself :
- Create the file /usr/local/Library/Formula/t-prot.rb and add the following (fantastically trivial) content:
class TProt < Formula
- Install t-prot (run the following Homebrew command in a terminal window):
brew install t-prot
- Add the following line to your .muttrc (or check ‘man t-prot’ or the t-prot web page for options and examples):
set display_filter="t-prot -cemt -M=mutt"
A nice, easy to follow article on how to install Linux alongside Mac OS X, using the rEFInd boot manager:
I didn’t expect it to be that easy, but OSS has really come a long way.