Categories
Mac

How to get rid of a stuck unread message badge on OS X

Having our messages (iMessage and SMS) available on our Macs is great, however sometimes we get an unread badge that can’t seem to go away, no matter how hard we look for the unread message, it is just not there1.MessagesBadgeIn many cases, however, the solution is simple, and you don’t even need to reboot.

  1. Quit Messages
  2. Restart the dock, either using Activity Monitor or running killall Dock from the terminal

Many thanks to crazyj on Stack Exchange for sharing this easy trick.

  1. Pro tip: you can see which conversations have unread messages by right clicking on the Messages icon. Not that opening these would help getting read of the stuck badge, however.
Categories
Mac

Delete undeletable files on OS X

Today I found myself stuck: I couldn’t delete a directory from my Mac, no matter what I tried, sudo or not.

Undeletable file
Turns out, for some reason the schg flag was set on that folder. schg, or “system immutable” flag, prevents even root from doing anything with that file. Fortunately, root is allowed to remove that flag, and then delete the file.

sudo chflags noschg undeletable_file_or_folder
sudo rm -rf  undeletable_file_or_folder

Problem solved.

(Always be careful copying and pasting sudo rm -rf commands from the internet.)

Categories
Mac

Clipboard new-line format when copying from Preview

Today I helped my brother with a Keyboard Maestro macro he needed. Basically, he wanted to take some text from a PDF created by Notability, which inserts new lines to have text flow around images, and remove these new lines.

Preview

Pretty easy, I thought: pbpaste to tr and remove \n. Nope. For some reason, maybe some old Mac OS 9 heritage, when copying text from Preview new lines are saved as carriage returns, i.e. \r.

This stupid behavior means that if you try to pbpaste something which contains line breaks in your terminal, you only get the last line. You can view the full output by replacing \r with \n:

pbpaste | tr '\r' '\n'

This lame thing had me waste some time, so I hope this short post makes your life easier.

P.S.: The full command I had my brother put in Keyboard Maestro is:

pbpaste | tr '\r' ' ' | pbcopy

Followed by a Paste action. This replaces line breaks with spaces and pastes the result.

Categories
Mac

Get rid of the “Open from iCloud” window in Mavericks

Since the introduction of iCloud in many OS X apps in Mountain Lion, we’ve had to live with the pointless “Open from iCloud” window every time we launched these apps. I’m speaking mainly of TextEdit and Preview, but recently even more apps got this useful feature, such as Automator and AppleScript Editor.

iCloud for TextEdit - we all hate this.
This. We all hate this.

But last month Apple released Mavericks, which came to save us from this hell. It offers a great solution: the ability to enable/disable iCloud on a per-app basis, thus allowing us to only have it on apps that benefit from it (Pages and Byword, for example).

Without further ado, let’s go and kill iCloud for TextEdit & co.

It’s pretty easy: just go to System Preferences/iCloud and click the “Options…” button next to “Documents & Data.

System Preferences/iCloud/Documents & Data/Options…A nice popover will appear and it will let you chose the apps in which iCloud documents will be available. Deselect any apps you wish, and then click “Done”.

DIsable iCloud documents in unnecessay appsFreedom. Enjoy the sense of freedom that comes from your apps being iCloud-free again, like in the good ol’ days.

Now, the next time you open TextEdit, you will be greeted with a glorious empty document, ready to be filled with your awesome words.

TextEdit is now iCloud-free

 

 

Categories
Mac

How to fix coreaudiod 100% CPU usage

Today, when I booted my Mac I noticed it was really unresponsive, and the fans immediately started going up like crazy. Through Activity monitor, I found the cause for this: coreaudiod was using 100% of my CPU. And force quit did not help.

core_audio_by_rob190975Core Audio is the framework that manages audio on OS X, and it’s awesome, except when it suddenly decides to go crazy and suck all my CPU.

After some googling, I found this post by Axel Jensen, and it literally saved my day.

Basically, for some unknown reason, my /Library/Preferences/Audio/ folder had disappeared, and that really angered coreaudiod. As Axel found, the solution is pretty simple: recreate the folder and set the correct permissions, with just two terminal commands.

sudo mkdir /Library/Preferences/Audio
sudo chown -R _coreaudiod:admin /Library/Preferences/Audio

I did some additional research and found out that it’s also safe to restore that folder from a Time Machine backup, or any other backup really, just make sure to set the proper permissions with the second command above. This way I was able to get my aggregated audio interfaces back, and I did not have to re-create them in Audio MIDI Setup.

Categories
Mac

Record multi-track Skype group call on OS X

A friend of mine and I host a weekly podcast and, as it often happens, we speak with our guests via Skype. For a while we had everyone record his own audio, since we wanted to have a separate track for each person in order to get the best possible audio quality. But that was inconvenient, both for our guest and for us, as we had to wait everyone to send us his audio before mixing and editing the episode. Recording Skype’s group call in a conventional way wasn’t a better solution. We’d only have two separate tracks: mine and everybody else’s, This is fine if there is only one person other than me, but it’s not with more guests.
So I started to think on possible solutions, and the best one that came to my mind was to have a separate instance of Skype running for each guest (I’ll explain how to do this later on) and use Ableton Live to record each track and to manage the audio routing.

Ableton Live is quite expensive, though, and if you don’t already have some experience with it that justifies purchasing a license, I’d advise you to check out snkl’s post that explains in detail how to achieve the same result with a much cheaper (but still great) app: Rogue Amoeba’s Audio Hijack 3.

My awesome hand-drawn scheme
My awesome hand-drawn scheme

To manage the audio, we need some sort of virtual audio cables to connect Skype to Ableton Live. The best tool is SoundFlower, so head over to their site, download and install it. However, it is not ready for our purpose right out of the box: we need 2 “virtual audio cables” for each Skype instance, and Soundflower only ships with 2 of them enabled by default (and only one of which, the 2 channel one, is suited for our needs). I managed to edit Soundflower’s plist file to get more.