Remote X11 application windows

When you are running an application on your local Mac from a remote SSH tunnel (via ssh -X), and that application needs to spawn windows programmatically, your local XQuartz server will not be able to draw the windows unless you set “Allow connections from network clients.”


We ran into this when running MatLab R2013 (or so) via an ssh tunnel from a remote RHEL6 compute server: the MATLAB script spawns windows that are java figures, and the local XQuartz server by default wouldn’t draw them — although oddly, they did spawn. With this switch set, it works, as shown:


The dreaded persistent gatekeeper dialog

Ok, so there’s a quirk in Mac OS X (el cap, at least) that if you install a mozilla product (or, probably, anything else) from the internet as one administrator, but don’t open them up and clear the Gatekeeper dialogs, then log out and log in as another user, the standard dialog noting that they are internet applications will persist. In other words, every single time the user who did not install the application opens it up, they’ll get a dialog box saying “This application is from the internet, are you sure…” yada yada yada. It’s annoying for them.

The solution is to log in as the original user, and launch the application, to clear the dialogs. The xattr trick doesn’t work here, for reasons unbeknownst to me. But in case you’re searching the web and it comes up, I hope this helps.

You could also try installing as the current user, if the permissions are sufficient.

portsUpdate: Keeping MacPorts Up to Date

Mmmmmk, so apparently cron is going the way of the dodo on OS X/Darwin. Best practice is to move your cron jobs to launchd. Here’s the Apple kb info for timed jobs using launchd (which includes the notice of deprecation) and here’s a great tutorial on using launchd.

My goal was to automagically keep MacPorts up-to-date, ala Ubuntu’s unattended upgrades. Because I’m old, I put port selfupdate, port upgrade outdated & port uninstall inactive in root’s crontab, but then today I was reading more and decided that I really ought to do it the Mac way since it’ll be upgrade proof.

Introducing portsUpdate! You can download the portsUpdate via git.
portsUpdate is copyleft.

Note: portsUpdate works with OS X 10.11 El Capitan. I am not going to test it with older Mac versions, although if your system runs launchd, you could try it. YMMV, I’m not responsible if you break your system in any case.

portsUpdate is a launchd xml file that runs a bash script once daily to update MacPorts, an associated launchd xml to ensure that the path is correct, and an associated installer.


If you trust me (don’t, why would you), you can just download the installer, open, &…
$ cd yourDownloadsDirectory
$ chmod +x InstallMacPortsUpdater
$ sudo ./InstallMacPortsUpdater

& have a coffee. Your MacPorts will update every morning at 3:30 a.m. & your old packages will be removed every Sunday to keep your system running lean.

If you want to know how to use it and want to read the scripts (or even improve upon them!) please read on along…

In particular, note the policy on timed launchd jobs and the computer state: if your machine is asleep, it’ll run when it wakes, if it’s off, it’ll run the next time it’s scheduled.

I tend to enable Power Nap, especially on fixed workstations:

System Preferences > Engery Saver > Enable Power Nap

Screen Shot 2016-08-09 at 12.43.45 PM

So if you want to inspect it before you install, just:

$ git clone
$ cd portsUpdate

Note that there are four files:

And then to install you would just set Install executable if it isn’t, then run it with sudo.

So. setenv.PATH.plist resolves an issue with launchd which is that scripts/applications/programs in /opt/local/bin are not in launchd‘s path.
com.seannyob.portsUpdate.plist tells launchd where portsUpdate is located & when to run it.
portsUpdate is a bash script that runs updates, upgrades & cleanup of your MacPorts package database, ensuring that you are always up to date on features & any security &/or bug fixes of your critical unixy apps.
Install is the same as InstallMacPortsUpdater above. It is a bash script that checks to make sure you’ve installed MacPorts, then git, then gits the package, then installs the three other aforementioned files in their appropriate places in the file system, then loads them into launchd using launchctl.

Note in particular that if you wanted to modify the time &/or frequency of updates/upgrades, you could do so in com.seannyob.portsUpdate.plist and the frequency of uninstall inactive is set for Sundays in portsUpdate.

Feel free to peruse them and use or modify them to your liking. If you have comments &/or suggestions, please let me know!

Gotta Mac? Wanna (more) current bash shell?

Mmmk. So I got this groovy new iMac and was excited to try out Terminal app, which is indeed cool, but for some bizarre reason the default system shell is a generation old. Meh.

Screen Shot 2016-08-08 at 2.40.39 PM

WTH? Ubuntu’s at 4.3.36!

Time for MacPorts! Go there, install the correct package for your version of OS X, and do a

$ xcode-select --install
$ sudo port install bash

Screen Shot 2016-08-08 at 2.50.22 PM

Ok, cool, so yeah now you have it, but you want it to be your default shell.

I suppose you could symlink /bin/bash to the Mac ports version, but that seems a little hardcore.

Let’s do it the “right” way:

$ sudo echo '/opt/local/bin/bash' >> /etc/shells
That adds the newer bash from Mac ports to the system.

To make it your default shell:

chsh -s /opt/local/bin/bash

Exit and restart terminal and you should see:

Screen Shot 2016-08-08 at 2.59.53 PM


Make sure to keep things current by periodically running a:

$ sudo port selfupdate