Category Archives: Mac OS X

Installing GCC-7.3.0 on macOS High Sierra

I talked about getting GCC-5.3.0 running in a previous post. As part of some benchmark testing I’m doing for a new computer build, which I hope to write about in a future post, I ventured back into the world of parallel programming. I used the excellent instructions from Solarian Programmer found here to get GCC-7.3.0 running on macOS High Sierra 10.13.3.

Strictly speaking, the link above points to instructions for compiling GCC-7.1.0. While it’s not a big deal to modify these instructions for 7.3.0, here’s a text document with just the command line instructions to get 7.3.0 up.

Note: I did have to make one small deviation from the instructions provided in the link (as noted in the text document attached). I tried to “make” GCC7.3.0 with “make -j 4” but it failed, stating it couldn’t fine “<ctime>”. I retried the make using “make -j 1”, which took a LONG time but worked. I would try 4 first and only if it doesn’t work, try 1.

My previous post also talked about getting OpenMP/Clang running in Xcode and the link provided there works. I did try the steps but couldn’t get it to work. Maybe I’ll try again later but for now, I’m using the command line to compile the OpenMP code.

Allowing different orientations by device (iPad vs iPhone)

I’ve been watching the Developing iOS 11 Apps with Swift podcast (yes, iTunes U content is now available as podcasts, which is cool because you can view them on your Mac) and playing around the Concentration app. This app really wants to be Portrait on an iPhone but Portrait or Landscape on an iPad, given the whole master/detail thing.

I searched for ways to do this and while apparently you can do this in code, this method is super simple. You can add another Custom iOS Target Property to your Info.plist under the Info tab of your project’s target, specifically for iPad. The main one is:

Supported interface orientations

The iPad specific one is:

Supported interface orientations (iPad)

Here’s a screen shot to show it in action.

Hope this helps!

Installing Octave 4.2.1 on macOS Sierra

I’ve been using version 4.0.3 of Octave for some time, installed via the binary available from SourceForge. It works reasonably well, with the exception of having to return to Terminal to enter commands for paged output. I wanted to move up to the current version and managed to get version 4.2.1 installed using HomeBrew. In case you are interested, here are the steps I followed:

  1. Open Terminal
  2. Enter the command: /usr/bin/ruby -e “$(curl -fsSL”
  3. Press RETURN
  4. Install homebrew/science using the following command: brew tap homebrew/science
  5. Octave requires XQuartz, install using: brew cask install XQuartz
  6. Install Octave using the following command: brew install octave
  7. Wait for a bit, then installation finishes

At this point, I “cd’ed” to the bin directory and attempted to run Octave with the following command:

cd /usr/local/Cellar/octave/4.2.1_2/bin/

Sadly, this produced the following error:

dyld: Library not loaded: /usr/local/opt/hdf5/lib/libhdf5.100.dylib
  Referenced from: /usr/local/Cellar/octave/4.2.1_2/libexec/octave/4.2.1/exec/x86_64-apple-darwin16.5.0/octave-gui
  Reason: image not found
octave exited with signal 6

After some poking around Brew’s install of Octave, I noticed the library in question (located at: /usr/local/opt/hdf5/lib/) had been updated to version 101 (libhdf5.101.dylib), instead of the expected 100 version. I also noticed there was a symlink from libhdf5.dylib to libhdf5.101.dylib. So I just duplicated that symlink, renamed it libhdf5.100.dylib and reran the ./octave command. Everything works!


P.S. I made a small text file that contains the following:

# Runs Octave 4.2.1


and saved it to the Desktop with the filename Octave.command. Then in Terminal, I made it executable by running the following: chmod +x Octave.command

You can now double-click this file to run Octave!

OpenMP Clang in Xcode

I’ve been playing around with prime numbers recently, which (naturally?) extended into an investigation into parallel programming. I installed the latest version of GCC 5 (v5.3.0 at the time of writing) using these instructions and got OpenMP running (support is built-in). I’m fine with using Terminal but I thought it would be interesting to try this in Xcode.

I installed the OpenMP C/C++ language extensions for Clang using homebrew with instructions from here. Unfortunately, I received the following error:

can't exec '/usr/local/bin/clang++-omp' (No such file or directory)

It turns out those instructions were missing a symlink that needs to be created. It’s as follows:

sudo ln -s /usr/local/bin/clang-omp++ /usr/local/bin/clang++-omp

Thanks to Stack Overflow for the “full” instructions. I can now build and run C++ parallelized code directly inside Xcode. I am finding a performance difference running the same code via the Terminal vs inside Xcode (which is slower). Hmm…

Solving iTunes 3014 Error

For whatever reason, probably because I do iPhone development and am always installing “stuff” on my computer and iOS devices, I’ve run into the dreaded iTunes 3014 error consistently when trying to restore my iPhone/iPad to put a new OS on it. I swear I tried this before and it didn’t work but I just followed the steps below and everything is updating nicely. iOS 9 GM!

  1. Open Terminal and cd to the /etc folder.
  2. Using your editor of choice, mine is nano, open the hosts file (sudo nano hosts).
  3. Enter your password.
  4. Add the following line to the bottom of the file:
  5. Write out/save the hosts file and exit (ctrl-O then ctrl-X for nano).
  6. Finally, flush the DNS cache with this command: dscacheutil -flushcache
  7. All done!

Ctrl-drag to Create Outlets in Custom Views

If anyone can tell me why Xcode (I’m using Xcode 7 beta 5) works this way, I’d greatly appreciate. I have created custom table view cells in the past and I’ve always control-dragged from my storyboard into the custom class to create the outlets. So, when I went to create outlets for a custom (ui)view I’m working on, I was stumped when I couldn’t ctrl-drag into the .h or .m file to create them (outlets or actions).

[Yes, I have all the relevant custom classes specified in the Identity inspector.]

The workaround is to type in the outlet/action code by hand. Once you have entered in your custom class file, you can connect the outlets/actions by dragging from the little dot (do these things have a special name?) Xcode puts in the line number gutter to the relevant UI element. What a pain in the ass.


Handoff in iOS 8 and Yosemite (Beta)

I’ve been trying to get Handoff, one of of iOS 8’s Continuity features, to work since the betas of iOS 8 and Yosemite were available on the Apple Developer Site with very limited success. Now that iOS 8 is GM, it seems to finally work. Here are the steps I took to get it working.

First off, you need to make sure all of your devices are logged into the same Apple ID account. If you tap on the Settings app and scroll down to iCloud, iOS 8 now shows you which Apple ID you are logged in with, very handy. Same for OS X Yosemite, go to Settings > iCloud and on the left side beneath your photo is the active account. This was the case for me, so I moved on to the next step.

The main problem I had was my Mac and my iPad were not showing up in my iPhone’s Bluetooth settings panel. Restarting both my iPad and iPhone, as well as toggling Bluetooth off then on seemed to solve this issue. Note: It can take your iPad or iPhone a LONG time to see other devices (e.g. Mac, iPad, or iPhone) via Bluetooth, so you have to be patient.

Once both devices were restarted, all my other devices started to show up in the Bluetooth settings area. If this isn’t the case, try restarting again. Once you “see” them in Bluetooth settings, Handoff will work.

Of course, Handoff only works with apps that support this feature, such as Maps, Messages, Mail, Safari, Calendar, etc. I’ve already seen third party apps supporting it, so make sure to update (ideally via auto update) the apps on your devices. Also, I’ve only been able to activate Handoff (for iOS devices) from the Lock Screen. Maybe this is how it works. I really like how OS X Yosemite handles it, with a new icon on the left end of your Dock. If you know how to activate Handoff other than from the Lock Screen, I’m all ears!!!

[In iOS 8, a “grey” icon appears in the bottom left corner of the lock screen of your device. Swipe up (and possibly enter your passcode) to active Handoff.]

Finally, there still seems to be a few glitches. I noticed my iPhone or iPad didn’t always show the icon for the app I had activated on my Mac. For example, I’d bring Mail to the foreground, check my iPhone’s lock screen and see the little (grey) Mail icon in the lower left. Then I’d switch to Safari on my Mac. Sometimes the iPhone would update the icon to Safari, sometimes it wouldn’t. However, I’m sure this feature will just get better in future updates. For now, I’ve been able to get it work between Mac and iOS devices and between multiple iOS devices.

Not rocket science but hopefully this helps.


Garmin ANT USB Stick/Agent Issues

Virtually every triathlete I know owns a Garmin product of some kind and I’m no exception. I’ve been using Garmin hardware products for over 5 years now and am continually disappointed with several aspects of the experience. Here’s my latest issue. It’s probably not a big deal but if you have a Garmin USB stick plugged into your Mac and are running the Garmin ANT agent, you might want to check this out.

The Problem

I have a Mac Pro tower that I run as a server. It’s always on. I decided I would plug my Garmin USB stick into it and leave the agent software running. That way, whenever I came home, I would put my Garmin (310XT) on the computer table while I went to shower and my workout data would be downloaded and ready to go. This has been working well for about 6 months. This morning, completely unrelated, I was perusing my system log (via the Console app) and noticed a LOT of activity I had never seen before. There were literally hundreds of lines that said:

Jan 23 08:12:30 Mac-Pro kernel[0]: USBF: 3091688.364 AppleUSBUHCI[0xffffff80e1014000]::Found a transaction past the completion deadline on bus 0x3d, timing out! (Addr: 2, EP: 1)

I don’t know all the details behind what’s going on here but it appears if the Garmin USB stick is plugged in and the Garmin ANT Agent software is running, it polls the USB bus every 1-2 seconds. During this “activity” it seems the agent software does not quite clean up after itself, causing lots of system log entries. Surprise, surprise.

Now, this is probably not a big deal for my dual processor, quad core Mac Pro. However, I imagine there has to be some sort of performance hit, not to mention severely bloated log files (which make finding something you are really looking for quite difficult).

The Solution

Fortunately, there’s an easy fix. Just unplug your stick and the agent software stops polling. No idea if this affects Windows users and realistically, I doubt it affects many people but I thought I’d share.

Update Feb 2, 2013: I’m actually doing the reverse now. I leave the stick plugged in and just run the ANT Agent app when I want to download data.