Skip to main content

Posts

Showing posts with the label Mac OS X

In quick praise of Quinn "The Skimo"

Apple is dismal with their documentation, and their Feedback Assistant is a cruel joke and waste of time that makes users and devs work for free for one of the biggest companies in the world – and then ignores them anyway. So when you're diving for information among the layers of deprecated debris, you end up noticing and remembering the rare nice nugget.  I've been noticing the name of Quinn "The Skimo" appearing at the bottom of many random dives, I'd swear since before OS X. And I just found that I'm not the only one remembering him! People in Hacker News also noticed the same .  So, I just wanted to thank you, Quinn "The Skimo"! (Possibly I failed to notice others with less memorable signatures... there's a lesson here)

What kext was that??

MacOS sometimes asks you to accept some system extension / kext. Unfortunately it can be difficult to clarify why, which can be scary. Sometimes you will only get notified that the kext signed by XYZ has been updated, and then it's on you to find out how to relate XYZ to a specific file and functionality in your system. I have found myself in the situation a couple of times, so in case it helps others, here's my notes to connect signers with kexts. BEWARE, just because something is in my list doesn't mean that it's OK in your system; instead, I recommend that (1) you re-confirm my information and then (2) decide if this kext makes sense in your system. If you don't know why you have some kext, maybe you should just remove it.

A script to announce new chat messages in Zoom

Available at https://github.com/hmijail/announce-zoom-chat-messages . It's so disheartening to see AppleScript to stay so ... unloved. It was never easy to deal with it, enough so that I decided this time to force myself to get into the newish JavaScript syntax. And yes, that eases the syntax; but the whole ecosystem feels so devolved since the last time I used it. Even Apple's own Accessibility Inspector has lost capabilities. osacompile works but the resulting app does something different. I didn't try looking for new Scripting Additions, and in fact it wasn't needed; good old System Events was enough. But, gosh... even Smile was last released on 2013 . I wonder how would I do something like this announcer without AppleScript. What do Windows users do? Well, who cares for Windows ;P, what do Linux users do? Maybe next time I'll have to research it.

Flame Graphs vs Instruments in OS X: using Intel's Performance Counters

TL; DR: as of last update for OS X 10.11 / Instruments.app 7.1, you can't really create meaningful CPI Flame Graphs on OS X because of bugs in Apple's tools, both GUI and command-line. There are some alternatives and workarounds; for an alternative to a CPI Flame Graph, Instruments.app might be good enough. I sent 6 bug reports to Apple, and 5 of them got marked as duplicates; so maybe some Instruments post-7.1 will get good enough to allow the data extraction needed for real Flame Graphs. I have been trying to generate Brendan Gregg's Cycles-Per-Instruction Flame Graphs  on OS X (10.10), mostly to check cache-related CPU stalls. However, after working on it for a good while, it's looking to me like the given method is somewhat shaky, and the same or better insights about the code can be gotten more easily; partly thanks to Instruments.app,  … a nd partly in spite of Instruments.app.

Stopping OS X's from storing locally IMAP messages

TL;DR: Mail.app wants you to download your messages even if you change manually the account .plist. Forget about it. I wanted to stop Mail.app in OS X 10.10 Yosemite from caching locally my IMAP messages. Once upon a time there was right there in Mail.app an option to do just that, but for the last couple of OS versions the only option shown there is whether to download the attachments or not.

Using OS X’s syslogd to receive log messages from the network

TL;DR: avoid this buggy mess and go with macports & syslog-ng. You'll finish faster and saner. [Updated 2 times] This sounds like should be easy, but OS X is a moving target because of all the infrastructure changes they have been making for the last few OS releases. Yes, there is a syslogd, but it is some half-hollowed out thing and “others” do most of the work. Syslogd does NOT open an UDP socket, launchd does and feeds it to syslogd. Syslogd does NOT (really) receive the UDP packets, a plugin does it. Syslog does NOT parse the UDP message, ASL (Apple System Log?) does. Syslogd does NOT filter the messages and store them into “logs”, ASL does. So why there is a syslogd at all, apart from giving a slight sense of false security? (As in, “c’mon, there’s syslog, can’t be too difficult”). No idea. If I had seen how complicated this was going to get I would have bailed out and used syslog-ng from macports. Anyway. So the first step is to enable UDP reception. The manpage f...

Filing the PIT from Mac OS X

If you are security-conscious, you probably have limited all kind of things that Adobe Reader can do (Javascript, opening links, …). Probably also in you browser configuration (plugin activation or even desinstallation), you OS configuration (limiting which programs can run and when, uninstalling things, etc). You might even have a Mac. ;P But then some program comes around which just assumes things to be standard and doesn’t try too hard to adapt to anything. Like the e-Deklaracje program used for filling in the tax documents in Poland (PIT-37 in my case). Made with Adobe AIR, and needed (?) to minimize the red tape, so the fuckers can count on the user doing whatever is necessary to appease the monster. The first couple of years I used a Virtual Machine with Windows XP for those things. But already for the last couple of years I have managed to do everything in Mac OS X; I only have to remember all the little tweaks that have to be done or undone so the e-Deklaracje program run...

A hacky fix for SuperDuper running out of space: "delete first" with rsync

Rsync has a possibility to delete the to-be-deleted files in the destination before it starts syncing files that actually need syncing. That is sorely missing in Shirt Pocket's program SuperDuper!, which is actually a nice backup program, and for some time was one of the few sane options available to make fully reliable backups. SuperDuper! just starts copying blindly, and can then find itself in the situation where the backup destination can't contain the new files + the old files that should be deleted but still weren't. So that problem would be solved with rsync's "delete first" behaviour. I see there have been people complaining about this in Shirt Pocket's forums for at least 5 years, and the developers seem to only say "yes, we will do something sometime". But they still didn't. So, this is the command line to be used: sudo rsync --delete --existing --ignore-existing --recursive  /Volumes/ORIGINAL_VOLUME/ /Volumes/BACKUP_VOLUM...

Enlaces a mensajes de correo

Gruber, de Daring Fireball, escribió hace tiempo sobre la posibilidad de crear URLs que enlazan a mensajes en tu buzón de Mail.app . Y es algo tremendamente útil y que no veo publicado en español, así que aquí pongo un pequeño resumen. Primero: de qué se trata exactamente? Pues que es un enlace que, cuando clicas en él, se abre Mail.app y te muestra el mensaje concreto que sea, en medio de tu buzón. Muy útil si por ejemplo dentro de 2 semanas tendrás que usar un mensaje que acabas de recibir: puedes usar el enlace al mensaje en iCal, de forma que la alarma que te saltará dentro de 2 semanas tiene un link que al clicarlo abre el mensaje correspondiente. La cosa es que Mail.app entiende esas URLs, y se crean automáticamente si por ejemplo arrastras un mensaje desde Mail.app a iCal. Tienen este aspecto: message:// , donde MESSAGE-ID está contenido en las cabeceras de cualquier mensaje. Y sí, es muy útil, pero Mail.app no tiene una forma directa de crear tales links. Una forma es...

Huawei E220 3G modem drivers on OS X Lion: only 32 bits

I recently installed Mac OS X 10.7 Lion, and found that it already had drivers for the Huawei E220 3G modem. But the drivers are 32 bit, so they won't work for machines which use a 64 bit kernel. And there seem to be no 64 bits drivers, so the only solution for now is booting in 32 bit kernel mode (pressing 3 and 2 when booting). I seriously doubt that Huawei are going to publish updated drivers; they were already rather unsupporting even when the modems were new. Eventually, I plan to try to make my own driver, but that won't be short-term...

Tcpflow and connections between local interfaces

Looks like tcpflow doesn't see connections between local interfaces. After a bit of digging, looks like such connections are "routed internally by the kernel", at least in Linux. And there are patches for Linux to force those packets out of one interface and in from another, but even that is only useful if you have an external network connecting both interfaces (looks like a simple crossover cable should be enough). http://www.ssi.bg/~ja/send-to-self.txt There is another option: using iptables to first make the packets leave the machine towards some external IP, and then using arpd to make a router send back those packets. http://serverfault.com/questions/127636/force-local-ip-traffic-to-an-external-interface And I see people reporting that tcpflow -i lo does work for them, capturing flows having local addresses even though different than 127.0.0.1. http://fixunix.com/tcp-ip/327123-capturing-tcpdump-local-traffic.html The interesting thing is that people seem...

FileMon-like functionality on OS X as a one-liner dtrace script

I first thought about this as a lsof substitute, but no, it's more like a primitive / simple FileMon/fs_usage. It shows the executable and the file it opened. Could be improved, of course. Dtrace is amazing. sudo dtrace -qn 'syscall::open*:entry{ printf("%s %s\n",execname,copyinstr(arg0)); }' fs_usage shows much more information... but is not a one-liner ;P

mplayer vs. polish subtitles

Typically, when I start seeing a film, I only have enough time to quickly get some subtitles, try to make them more-or-less work with the film at hand and ... that's it. So, lots of repetitive, rushed fixes but no long-term solutions. But this time I got sick of it and tried to get to understand the problem. Which is: Polish subtitles don't work with mplayer, or at least not with the mplayer built with MacPorts' mplayer-devel port, which uses mplayer's SVN HEAD. The option -subcp cp1250 does select the codepage (cp1250 is variously called Windows Latin 2 or Windows Central European encoding, which seems to be the typical encoding used by polish subtitles on the net) The option -subcp enca should auto-detect the encoding, but the port disables enca at configure time, and provides no way to enable it. I'll try to send a patch for that. In the meantime, enca -L pl -i file by itself works nicely (enca is provided by a port). For difficult cases when enca fails...

Toshiba G450 en Mac OS X Lion

Los drivers que Toshiba publicó para el G450 en el 2008 son sólo 32 bits. Si tu Mac OS X Lion corre el kernel a 32 bits, posiblemente funcionarán. Pero si ordenador corre el kernel a 64 bits, lo cual creo que ya será la mayoría de macs, esos drivers no funcionarán. Y Toshiba no tiene pinta de  que vaya a publicar nuevos drivers, porque ya eran lentos con cosas de soporte cuando el móvil era nuevo, y ahora encima parece que la división de móviles de Toshiba se ... arrejuntó con Fujitsu en el 2010. Así que la solución a corto plazo es arrancar en modo 32 bits, lo cual se hace pulsando las teclas 3 y 2 mientras arrancas. Sólo el kernel pasa a modo 32 bits, y se supone que la diferencia no será demasiado grande en rendimiento - pero no sé de cifras concretas. Los programas seguirán funcionando a 64 bits. Curiosamente, OS X Lion lleva de serie drivers de Huawei para el modem E220 y algún otro. Pero son también drivers de 32 bits, así que estamos en las mismas. Y tampoco veo que Hua...

Toshiba G450 drivers for OS X Lion - only 32 bits

I recently changed computers and got a MacBook Pro which boots the kernel in 64 bit mode. The problem is, the only drivers Toshiba published for the G450 modem are 32 bit only (published on 2008). So the only solution for now is booting in 32 bit kernel mode (pressing 3 and 2 when booting). I seriously doubt that Toshiba are going to publish updated drivers; they were already rather unsupporting even when the modems were new. And Toshiba seems to have merged its mobile division with Fujitsu's... and even Windows 7 users seem to have problems. So... maybe this means that I should try to go back to the program-your-own-driver thing.

Building socat in OS X 10.7 Lion

socat (1.7.2.0 as of this writing) doesn't compile with the clang, the standard compiler in Mac OS X 10.7 Lion (10.7.2 as of this writing). It does compile if instead of clang one uses for example llvm-gcc-4.2.2. The developer reports that this is a bug; only gcc is supported in socat, but there are compatibility fallbacks for other compilers. Only, the fallback was missing on the file that fails to compile, xioexit.c. The fix is easy: @@ -5,6 +5,7 @@ /* this file contains the source for the extended exit function */ #include "xiosysincludes.h" +#include "compat.h" #include "xio.h" (if someone is trying to build something like socat, I guess he doesn't need help about patchfiles) This problem was also present in MacPorts' port for socat. I have already reported it and provided a new working portfile, so I guess it won't be long until it is published.

Directory permissions vs local Portfiles in MacPorts

~/MacPorts/ports$ sudo port install socat --->  Computing dependencies for socat could not read "/Users/mija/MacPorts/ports/sysutils/socat/Portfile": permission denied I was having strange problems to use a locally edited portfile. Turns out the permissions were wrong in a directory in the path; each of the directories should have at least o+rx permissions, and strangely my $HOME had none of those (strange because other users in my computer had o+rx, admins or not). Note that MacPorts lately (from 2.0?) has started to use the user nobody at some points of its workings, and root at others; in this case the user nobody was the one unable to reach the Portfile. A way to check what this user sees is " sudo -u nobody ls -leda@ /Users/mija/blabla ". A workaround is setting macportsuser in /opt/local/etc/macports/macports.conf to root, but that's not a good idea. MacPorts is doing the the sensible thing, de-escalating privileges when they are not needed; th...

dtrace'ing paging to disk

How to know which processes are paging to/from disk (as opposed to other VMM management) in OS X, and how much exactly: sudo dtrace -n maj_fault'{@[execname] = count()}' reference (with examples and other options): http://wikis.sun.com/display/DTrace/vminfo+Provider I had been meaning to look for ways to do this, and tried some of the tools included in OS X (Activity Monitor, top, Instruments, vm_stat, vmmap, top, ...). But nothing really helped, and/or seemed to miss the exact level of information I was targeting (only resulting in real I/O; relationship between I/O and process; realtime... ). Finally I had the inspiration to google for "dtrace pagefaults". Bingo. (dtrace in this example isn't realtime, but is the best approximation so far, and I'm guessing some tuning should fix it. Heck, it's a one-liner!) Learning dtrace is still something I'd love to do, and once again it is tempting me to let it jump to the front of queue... (Mhm, wi...

Compiling Transcode 1.1.6 and 1.2 in OS X

(express post, too much time spent on this but too much work spent to let it slip without benefitting someone else) 1.1.6 is not released, had to be hg-cloned. In fact, the repository looks like the 1.1.6 tag was at some moment added but then deleted?? That branch also has the latest video stabilization, no idea yet if it is also in 1.2 Can be compiled. Get the hg repository via hg itself, not one of the zip/bz/etc packaged from the website since the compilation scripts expect to find the .hg files. Read the README and INSTALL, you'll need to create the configure yourself (easy, just read) I am using MacPorts, and even installed the included Transcode 1.1.5, so all the requirements are already installed. Most of the expected work was about configuring tne non-macports transcode to use the /opt dirtree. (Incidentally: 1.1.5 has horribly mismatched documentation, I have had to resort to using strings and source code to understand what some of the utils were supposed to ...