Fixing Yosemite Bluetooth Issues After Standby

Introduction

Perhaps my 2010 MacBookPro is starting to feel its age? For some reasons it’s had a slew of Wi-Fi and Bluetooth related issues in recent months. The most recent is that after coming out of Sleep (standby) Bluetooth would remain in dreamland and refuse to function. In most cases I can’t turn it On or Off, or select any options or bring up context menus in the Bluetooth Preferences panel. Or if I can use the context menus, Connect and Disconnect don’t do much. It usually reports my external keyboard and trackpad are connected, but nothing works. It seems like the Bluetooth system has gone into a deep coma or died in its sleep.

I am about to install a Bluetooth 4.0 adapter, and perhaps the built-in BT has cottoned on, and is kicking up its feet in disgust? Truth is, if it wasn’t messing with the Wi-Fi connection so much in the past month (seems the two have been at war with each other), I’d not have considered adding an external BT adapter to begin with — more on that in another article. Here’s how to potentially resolve these issues of BT dyeing in its sleep.

Solution for Bluetooth failure after Sleep mode

The best solution I found was to unload and load the KEXT for the Bluetooth hardware. If you don’t know what a KEXT file is, don’t worry. Kind folks have provided an automated (scripted) way to deal with this. First step is to test whether this method actually resolves your Bluetooth failure after system sleep.

NB. In a few places these instructions assume you are using OS X Yosemite, as that’s the OS in which this Bluetooth issue commonly occurs. If you have at least OS X 10.8, you should be fine. The only relevant point is in the way .command files are handled in Finder.

1) Pre-test: First you’ll need to test this out. Run the following two lines of code in Terminal.app

You will be prompted for your password. Type it in (no text will appear when you type it, so just hit Return/Enter key after you type it in).

Now test out your Bluetooth peripherals. If they are working again, then the above solution works for you. So the next step is to automate it.

Automation of the fix:

There’s a few ways to do this. We’ll cover three. If you have Homebrew installed on your system, follow step 2A. If you don’t have Homebrew installed (and perhaps don’t even know what that is, except a DIY way to make beer) follow instructions at 2B. Or, alternatively, if you prefer to use Automator, follow instuctions at 2C.

The first two methods will install a neat little utility called Sleepwatcher. This gives you a means to have scripts, etc., run when your system sleep state changes in any way. The third method, using Automator, is less automated. It gives you a way to manually execute the command line entries you tested in step 1 above.

2 A) HOMEBREW METHOD (with Sleepwatcher)

Create a text file in your user home directory (or, for instance, in your Downloads folder) using a text editor. Paste in the following code:

Save the file with the name bt-fix.command

Execute the script

In Yosemite (and likely OS X 10.8 or later) you can now double-click .command the file in Finder, and it should execute.

You may need to make the script executable with the following command in Terminal.app

Unless you know how to change directory in Terminal over to where you saved your script, the easiest way to get the script name in there with the path is to just type the chmod a+x part into Terminal, add one space, and then drag the .command file from Finder to the Terminal window. That will automatically insert a reference to the file, with the full path.

2B) SCRIPT METHOD, NO HOMEBREW (with Sleepwatcher)

Create a text file in your user home directory (or, for instance, in your Downloads folder) using a text editor. Paste in the following code:

Save the file with the name bt-fix.command to a location that makes sense to you.

Execute the script

In Yosemite (and likely OS X 10.8 or later) you can now double-click .command the file in Finder, and it should execute.

You may need to make the script executable with the following command in Terminal.app

Unless you know how to change directory in Terminal over to where you saved your script, the easiest way to get the scriptname in there with the path is to just type the chmod a+x part into Terminal, add one space, and then drag the .command file from Finder to the Terminal window. That will automatically insert a reference to the file, with the full path.

2C) AUTOMATOR METHOD (without Sleepwatcher)

  1. Use Spotlight to find and run Automator
  2. Click “New Document” at bottom
  3. Choose “Application” for the new file type
  4. Click on “Utilities” from the list
  5. Double-Click “Run AppleScript”
  6. Replace (* Your script goes here *) with:

  • Press Play to test the automation. You will be propted for your password. Enter it.
  • Once done, save the file to somewhere convenient, such as your Desktop. File -> Save.

The Lazy Way

If you know nothing about Terminal, except that it sounds fatal, and all of the above seems to daunting and esoteric, you can just run the following application. I have bundled up solution 2B into an app that will do what’s required. Use at your own risk (I can’t think of any risks, but obviously the responsibility is yours, and not mine).

Download this App. Run it only once, if successful. Otherwise it will repeat certain steps and make a mess of your SleepWatcher configuration. Not a major to manually clean up, but worth avoiding. There is no reason to run it to completion more than once. It will install SleepWatcher, and give it the necessary commands to reload Bluetooth kexts after your computer comes out of sleep mode.

Credit

Credit for the ideas in this post go to the good folk involved in this discussion on apple.stackexchange.com

Additional Content and Pro Codec for Final Cut Pro X

In some situations when Final Cut Pro X is installed (such as on mass, in a group install environment) the “Download additional content…” option in the FCPX menu doesn’t work as expected. I’ve seen people posting online asking how to otherwise get this content. Here’s the links you need.

Additional Content for Final Cut Pro X

Final Cut Pro X Content v1.0
Download from here

Pro Codecs for Final Cut Pro X and Quicktime

Pro Video Formats 2.0.1
Download from here

Self-signed SSL certificates, CA flagged true, for Android and OS X

If you wish to run local web services, such as CalDAV, CardDAV, WebDAV, websites, etc., you may want to connect over SSL. Here are instructions on how to generate self-signed SSL certificates, on Mac OS X that have the CA flag set to TRUE, and which will be accepted my Android devices (which are particularly fussy about how an SSL certificate is cooked up).

As a give-my-private-data-to-questionable-private-cloud-service-companies non-believer, I run my own cloud and sync services locally. Three very handy services are CalDAV, CardDAV, and WebDAV (for sharing and syncing calendars, contacts, and files, respectively), all of which I can run locally on Mac OS X. This allows me to sync my OmniFocus data locally with Android devices, and to sync my contacts and calendars. The one catch is that I want to do all my syncing over encrypted SSL connections. That should be easy, and yet it’s taken me a great many hours to figure out.

The Challenge

The challenge is that although Mac OS X can generate self-signed SSL certificates fairly easily, it does not include a CA (certificate authority) flag in the certificate. For Android devices this flag needs to exist, and be set to True. After spending countless hours reading over forums where those before me had spent countless hours, and days, trying to generate a CA flagged True SSL certificate, and was about to throw in the towel. I have, however, stumbled upon the solution.

The Solution

1. Install OpenSSL

First off, if you have not already done so, you will need to install OpenSSL. If you have the package manager Homebrew installed, you can install OpenSSL with the following command:

Otherwise, you’ll need to follow the instructions provided here. Or install Homebrew (it’s very handy), and then use it to install OpenSSL.

To install Homebrew, it’s as simple as running the following command in Terminal:

2. Set your system up for generating SSL and CA

  • Create a directory in your home folder (or wherever else makes sense to you) called something like SSL. For instance, ~/SSL will do the trick. In Finder just hit ⇧⌘-G, and type in ~/
    That will take you to your home directory. Now create a new folder called something like SSL. In all the following instructions I will assume you create a directory at ~/SSL

In terminal type in: cd ~/ssl

  • In Terminal or in Finder (whichever you’re familiar with) create a text file in that folder and call it ca.cnf

Put the following in that file:

  • You might want to make some changes to this file. For instance you can change the default expiry of your certificates. Look for the parameter default_days = 365 and set that to however many days you want. Also, look for # EDIT THESE near the end of the file, and change those parameters to whatever works for you.
  • You need to set up the directories for your CA system to function within. Issue each of the following commands in Terminal:

3. Generate your CA

Use the following command in Terminal:

You will be asked for some information about the CA organisation. Enter something meaningful.
When that’s done, you should have a couple of new files:  ~/ssl/mypersonalca/certs/ca.pem and ~/ssl/mypersonalca/private/ca.key.

You should keep the ca.key file secret. This is not for public exposure. The ca.pem file is the one that goes public. This is the public certificate for your newly created Certificate Authority (CA). You can import that into your browser, and devices that you want to automatically trust your self-signed SSL certificates. There is, however, an additional step for using in on Android devices. We’ll cover that in a moment.

4. Generate your self-signed SSL certificate

Here we have two steps. First you create the SSL certificate, and next you certify it with your CA.

  • Use the following command to generate your 1024-bit private certificate:

You will be asked similar questions as those you were asked previously when generation the CA. Use meaningful information, as this is what you, and other people (depending on your usage scenario) will see when asked to trust the certificate.
IMPORTANT: The most important detail you will be asked for is the Common name. This should be the domain name or host identifier you are planning to use this certificate on. Something like, mydomain.com or mymac.local or even localhost (that might work, but I can’t say for sure). You can also use a wild-card, like *.mydomain.com

Now you need to sign your new SSL with your CA. Use the following command:

If you ever need to view the text contents of this file, or make a record of them somewhere, use this command:

5. Preparing your CA for Android

Android does not import ca.pem files. You need to convert them into a binary file format. To do this, use the following commands:

If you have your device plugged in and ready for DBA mode transfers, you can use the following command to push the file to your device:

If you have a different path to your device storage, change that command accordingly. Otherwise, in my case I use BitTorrent Sync. So I just drag that CA.crt file into one of the folders that sync to my Android devices, and it automagically makes its way there in a few seconds (assuming BitTorrent Sync is active on each device in that moment).

Once done, you will be able to tell Android to install the CA file via Settings -> Security -> Credential Storage and selecting “Install from storage”, and then follow the prompts.

Image Alt
Image and Android instructions courtesy of Jethro Carr

Importing the CA that is already installed on a server

If you have already installed your SSL on a server, you can fetch it into Android using a neat little app call CADroid

Another option is to browse on your Android web browser to RealmB’s Android Certificate Installer and follow the instructions there. It provides a web page which you can upload the ca.pem file to, and it will install it on your device. I’ve not tried it, but I hear it works well.

SMTP failure on OS X Mail Yosemite

Some users of OS X Mail, Yosemite, are facing issues where Mail ceases connecting to SMTP servers (that’s for outgoing email). It just happened to my computer today, and the fix indicates it’s a problem with the way Mail is storing/accessing the Keychain. At a guess. Some people also report that Mail repetedly requests the password. The solution below may fix that too.

My rant about Apple Mail issues (excuse me)

In my experience Mail has becoming increasingly unstable and issue prone in the last few iterations of OS X. 10.9.x introduced numerous problems with unread mail count data, and also the count for messages being sent and received. It was widely reported, but Apple failed to solve it. I hoped upgrading to Yosemite would put these issues behind me. Instead, they remained, and other issues have been introduced, also relatively widely reported. Anyway… that’s enough of a rant from me. Let’e get the show on the road…

Fixing SMTP connection issues on Mail

The solution may be relatively simple.

The first thing to try is rebooting your Mac. Some people report that solves the SMTP failure issue. In my case it didn’t help.

Next thing to try is to uncheck “Automatically detect and maintain account settings” for both the incoming and outgoing server settings.

You need to edit each account with the issue, and then edit the SMTP server. Try re-entering the username and password for the SMTP server. If that doesn’t fix it, then note the settings (server name, port number, ssl, etc.) and delete the SMTP account (hit the – button). Then hit the + button and create the account fresh.

In my case, on 6 smtp servers, that fixed the problem. You may need to restart Mail after making those changes. In my case that was not necessary, but some people report it was for that.

Fixing “files in the Adobe Application Support folder… are missing” error in Photoshop

Recently Adobe Photoshop CC 2014 on a computer I maintain started displaying this error each time it was started. Photoshop would still run, and the user could see no obvious effects from this error. But it was disconcerting and a bit of a nuisance to be presented with it each time they started Photoshop. Reinstalling Photoshop, as the error suggested to do, would be a relatively easy fix. But there may be an even easier one. I don’t imagine this issue affects many Photoshop users. Yet, in case someone else is looking to resolve it, here’s the answer.

The full error message was:

One or more files in the Adobe Application Support folder, necessary for running Photoshop, are missing. Please run the Photoshop installer and re-install Photoshop

The solution to this problem was as simple as copying the Adobe Unit Types.osax file from a system folder on a previous OS X installation, into the [main hdd]/Library/ScriptAdditions folder. The computer in question had been recently upgrade from an earlier version of OS X to Yosemite. The hard drive was replaced (upgrade to a bigger one) at the same time. It would seem this error may have started after the migration of the data from the old OS X installation (on the original drive) to the new OS X installation. So, obviously you’ll need to have an older /Library directory, and it’s contents, kicking around on a drive somewhere.

If you don’t, and  you can’t be bother doing a full reinstall of Photoshop, a copy of that file is attached to this post. In case you’re concerned about the file and what it does: The file itself serves a fairly basic function. So basic, in fact, that Photoshop happily runs without it. As far as I can tell, it’s related to the units used in Photoshop (e.g. cmtr, inch, kmtr, mile, yard, etc.). Below is a screenshot of the plist file within the Adobe Type Units.osax package.

NewImage

You can download the file here. You’ll need to unzip it before moving the .osax file into the location indicated above.