iOS Reconnect the cord

Hello, I’m William Smith and a Solutions Architect for 318, Inc., a technology consultancy based in Santa Monica, Calif.

Let’s talk about what we can do when we forego wireless on our iOS devices and reconnect the cord.

1 iOS - Reconnect the Cord.key - July 11, 2015 The nature of this presentation isn’t so much as “lessons learned” from the project I’ll be referencing—this isn’t a case study—but rather “nifty things I learned” while working on this project. I’ll also suggest some items for you to add to your toolkit.

2 iOS - Reconnect the Cord.key - July 11, 2015 1:1 iPad Initiative

• PreK-12 • 40,000 students • 5,000 faculty

This past year I’ve been on hiatus from my normal duties as a consultant to assist with an iPad rollout project for a large school district. During this past school year, we deployed about 30,000 to students and teachers. By the time the project is complete at the end of year 2015, the district will have distributed nearly 45,000 iPads.

3 iOS - Reconnect the Cord.key - July 11, 2015 Deployment • Wi-Fi + DEP + MDM • Symmetric multi-processing = Users

With this number of devices, the school district planned on using Apple’s Device Enrollment Program (DEP) and what I like to call the power of symmetric multi-processing to wirelessly enroll and manage its devices with its MDM. In other words, dozens or hundreds of users can set up their devices more efficiently and economically using DEP than someone doing it for them.

4 iOS - Reconnect the Cord.key - July 11, 2015 iOS 8 • Automatically downloading on devices • Not caching on our servers

We deployed iPads to teachers before school started last September and then iOS 8 dropped two weeks before we were to deploy our first student iPads. We’d planned for this. However, we noticed two things:

1) The 1.2 GB update was automatically downloading to iPads. That was OK. 2) Our OS X caching servers installed in each school weren’t caching the update.

This meant many devices were simultaneously downloading the update over the district’s Internet connection. Looking ahead, one school’s deployment could bog down the network.

5 iOS - Reconnect the Cord.key - July 11, 2015 Manual Upgrade • Apple Configurator • 16 Macs • 20 devices per Mac • 25,000 devices • 7 business days

We had to control the iOS 8 upgrade. The only way to do that was use Apple Configurator, which cached the 1.2 GB upgrade file to the Mac. The only way to use Apple Configurator was physically connect each device to a workstation and update each one.

Device by device, box by box and palette by palette (10 devices per box and 27 boxes per palette), we upgraded about 25,000 devices in 7 business days.

6 iOS - Reconnect the Cord.key - July 11, 2015 iPad Finger • iPads power on automatically • Configurator doesn’t power them off • Saved 13 days

We hired professionals to upgrade our 25,000 iPads, which was the primary reason this sub-project took as little time as it did. They had developed a little in-house Mac application that did something simple but extraordinary. It watched Configurator and as it finished updating a device the app made a few simple quality control checks and then shut down the iPad—powered it off.

That little step shaved off 15 seconds per iPad due to less handling (they never had to remove the iPad from the cardboard sleeve) and the time it takes to press and hold the power button and swipe the screen.

That’s more than 13 business days of time.

7 iOS - Reconnect the Cord.key - July 11, 2015 There was something to be said about what you can do when you bypass Wi-Fi and connect the cord. And some things you simply can’t do over Wi-Fi. More and more as I participated in this project, I learned some really cool things you can only do when you connect the cord to an iOS device.

8 iOS - Reconnect the Cord.key - July 11, 2015 ☐ Text Input ☐ Networking ☐ Screen Recording ☐ Console and logs ☐ Command line tools

We’ll spend a little bit of time talking about the first few items here.

I’ll cover a few ways of entering text on your iPad apart from using the on-screen keyboard and how you can use that to speed up preparing multiple iPads with the same information.

When MDM can’t talk to your iPad wirelessly, we’ll see how you can still connect it to your network and how it can save you a lot of headaches. Then we’ll cover a Yosemite and iOS 8 feature for viewing your iPad’s screen on your Mac and how you can use that for a documentation and support.

But I’ll spend more of our time talking about troubleshooting information we can get out of a device and ways of sending commands via command line, which we can use for scripting.

9 iOS - Reconnect the Cord.key - July 11, 2015 Text Input

Apple ID: [email protected] Password: sY}ezi[pp6gS

If you’re preparing a half dozen or more iPads, let alone dozens, hundreds or thousands, just entering Apple ID information is time-consuming, burdensome and a painful.

How would you like to have to type Apple IDs and passwords like this on the on-screen keyboard?

10 iOS - Reconnect the Cord.key - July 11, 2015 Text Input

Apple ID: [email protected] Password: sY}ezi[pp6gS

If you’re a touch typist, a more efficient way to enter data on an iPad is using an external keyboard.

11 iOS - Reconnect the Cord.key - July 11, 2015 Text Input

Logitech Wired Keyboard $59.99

Something like this Logitech Wired Keyboard that plugs directly into the 30-pin or Lightning port on the iPad work very well and it requires no additional power, cables or . Once you plug it in, it’s immediately ready to type. Cost is about $60.

12 iOS - Reconnect the Cord.key - July 11, 2015 Text Input

Lightning to USB Camera Adapter $29.00

If you don’t want to buy a dedicated 30-pin or Lightning keyboard then the first item I suggest adding to your toolkit is this Lightning to USB pigtail or as Apple likes to call it, a “Lightning to USB Camera Adapter”. It retails for $29.00 in most stores.

I want you to note that this is a female USB connector not a male connector. This isn’t a short version of the Lighting cable that comes with every iOS device.

13 iOS - Reconnect the Cord.key - July 11, 2015 Text Input

With just this connector, you can use most any wired USB keyboards you may have around the office such as the Dell extended keyboards that come with most PCs.

14 iOS - Reconnect the Cord.key - July 11, 2015 Text Input

However, Apple USB keyboards won’t work. Why?

Every Apple keyboard is a USB hub and the Lightning port on an iPad doesn’t generate enough power to support both keyboard input and hubs, whether anything is plugged in to them or not.

15 iOS - Reconnect the Cord.key - July 11, 2015 Text Input

So, how do we make Apple keyboards work?

The next item I suggest adding to your toolkit is a small powered USB hub. This Protonix USB 3.0 4-port hub sells on amazon.com for $10.95. The cost of it plus Apple’s Lightning to USB Camera adapter is about $20 below the cost of Logitech’s small wired keyboard.

When you add the hub, though, you now get the ability to do something really cool.

16 iOS - Reconnect the Cord.key - July 11, 2015 Text Input

You can eliminate the keyboard and replace it with a barcode scanner. This Esky brand scanner on amazon.com sells for about $19.99 and you can spend up to a few hundred dollars per scanner depending on any additional features you want.

17 iOS - Reconnect the Cord.key - July 11, 2015 Text Input Code 128B Barcode font • Uppercase letters • Lowercase letters • Numbers • Symbols

If you choose to use a barcode scanner then you also need to purchase a high quality barcode font, specifically supporting something like Code 128B barcodes. Code 128B supports: • Uppercase letters • Lowercase letters • Numbers • Symbols

Scanning a barcode means you’ll have not only faster data entry but accurate data entry the first time. If you had 50 iPads to prepare and had to enter five pieces of information on each such as username, password and Apple ID, think about what you’ll gain by pressing a button 250 times compared to typing unique usernames, passwords and Apple IDs 50 times.

Experiment where you can add a tab or return character at the end of the barcode to either move to the next field or tap the default button, which is usually “OK” or “Agree”. Depending on the quality of the scanner you purchase and monitor, you may be able to scan barcodes directly off your computer screen or you may find merging data into a Word document for printing individual cards for each iPad easier.

18 iOS - Reconnect the Cord.key - July 11, 2015 � Text Input ☐ Networking ☐ Screen Recording ☐ Console and logs ☐ Command line tools

That takes care of getting text into your iOS device. Next, let’s talk about networking.

19 iOS - Reconnect the Cord.key - July 11, 2015 Networking

Here’s the scenario: A user forgets his iPad passcode. After a few failed attempts, he disables his iPad for five minutes. The user restarts his iPad thinking that’ll reset the Disabled message. It doesn’t. After disabling his iPad again for 15 minutes, he comes to you to clear his passcode from your MDM server.

The problem this causes is it turns off Wi-Fi. The Wi-Fi credentials are securely stored in the iPad’s , which can only be unlocked by entering the passcode. Catch 22. How do get into the iPad?

The official solution is “you don’t—wipe the device.”

The official unofficial solution is to connect the iPad to a wired network and bypass Wi-Fi. I say “unofficial” because Apple doesn’t offer this solution as a support method but it’s been in iOS at least since version 6. And it continues to work up to the latest versions of iOS that I’ve personally tested.

20-1 iOS - Reconnect the Cord.key - July 11, 2015 Networking

Here’s the scenario: A user forgets his iPad passcode. After a few failed attempts, he disables his iPad for five minutes. The user restarts his iPad thinking that’ll reset the Disabled message. It doesn’t. After disabling his iPad again for 15 minutes, he comes to you to clear his passcode from your MDM server.

The problem this causes is it turns off Wi-Fi. The Wi-Fi credentials are securely stored in the iPad’s keychain, which can only be unlocked by entering the passcode. Catch 22. How do get into the iPad?

The official solution is “you don’t—wipe the device.”

The official unofficial solution is to connect the iPad to a wired network and bypass Wi-Fi. I say “unofficial” because Apple doesn’t offer this solution as a support method but it’s been in iOS at least since version 6. And it continues to work up to the latest versions of iOS that I’ve personally tested.

20-2 iOS - Reconnect the Cord.key - July 11, 2015 Networking

Let’s go back to a couple of tools we’ve added to our toolkit: • Apple’s Lightning to USB Camera adapter • Powered USB hub Let’s add a couple more items to our toolkit: • An Apple USB Ethernet Adapter for $29.00 • Ethernet cable

How does this all fit together?

1. First, plug the Camera adapter into the iPad. 2. Plug the USB hub into the Camera adapter. 3. Be sure to plug the USB hub into power. 4. Connect the USB Ethernet cable into the hub. 5. Connect the Ethernet cable to the USB Ethernet adapter. 6. Finally plug the Ethernet cable into the wall.

Simple!

21-1 iOS - Reconnect the Cord.key - July 11, 2015 Networking

Let’s go back to a couple of tools we’ve added to our toolkit: • Apple’s Lightning to USB Camera adapter • Powered USB hub Let’s add a couple more items to our toolkit: • An Apple USB Ethernet Adapter for $29.00 • Ethernet cable

How does this all fit together?

1. First, plug the Camera adapter into the iPad. 2. Plug the USB hub into the Camera adapter. 3. Be sure to plug the USB hub into power. 4. Connect the USB Ethernet cable into the hub. 5. Connect the Ethernet cable to the USB Ethernet adapter. 6. Finally plug the Ethernet cable into the wall.

Simple!

21-2 iOS - Reconnect the Cord.key - July 11, 2015 Networking

Let’s go back to a couple of tools we’ve added to our toolkit: • Apple’s Lightning to USB Camera adapter • Powered USB hub Let’s add a couple more items to our toolkit: • An Apple USB Ethernet Adapter for $29.00 • Ethernet cable

How does this all fit together?

1. First, plug the Camera adapter into the iPad. 2. Plug the USB hub into the Camera adapter. 3. Be sure to plug the USB hub into power. 4. Connect the USB Ethernet cable into the hub. 5. Connect the Ethernet cable to the USB Ethernet adapter. 6. Finally plug the Ethernet cable into the wall.

Simple!

21-3 iOS - Reconnect the Cord.key - July 11, 2015 Networking

Let’s go back to a couple of tools we’ve added to our toolkit: • Apple’s Lightning to USB Camera adapter • Powered USB hub Let’s add a couple more items to our toolkit: • An Apple USB Ethernet Adapter for $29.00 • Ethernet cable

How does this all fit together?

1. First, plug the Camera adapter into the iPad. 2. Plug the USB hub into the Camera adapter. 3. Be sure to plug the USB hub into power. 4. Connect the USB Ethernet cable into the hub. 5. Connect the Ethernet cable to the USB Ethernet adapter. 6. Finally plug the Ethernet cable into the wall.

Simple!

21-4 iOS - Reconnect the Cord.key - July 11, 2015 Networking

Let’s go back to a couple of tools we’ve added to our toolkit: • Apple’s Lightning to USB Camera adapter • Powered USB hub Let’s add a couple more items to our toolkit: • An Apple USB Ethernet Adapter for $29.00 • Ethernet cable

How does this all fit together?

1. First, plug the Camera adapter into the iPad. 2. Plug the USB hub into the Camera adapter. 3. Be sure to plug the USB hub into power. 4. Connect the USB Ethernet cable into the hub. 5. Connect the Ethernet cable to the USB Ethernet adapter. 6. Finally plug the Ethernet cable into the wall.

Simple!

21-5 iOS - Reconnect the Cord.key - July 11, 2015 Networking

Let’s go back to a couple of tools we’ve added to our toolkit: • Apple’s Lightning to USB Camera adapter • Powered USB hub Let’s add a couple more items to our toolkit: • An Apple USB Ethernet Adapter for $29.00 • Ethernet cable

How does this all fit together?

1. First, plug the Camera adapter into the iPad. 2. Plug the USB hub into the Camera adapter. 3. Be sure to plug the USB hub into power. 4. Connect the USB Ethernet cable into the hub. 5. Connect the Ethernet cable to the USB Ethernet adapter. 6. Finally plug the Ethernet cable into the wall.

Simple!

21-6 iOS - Reconnect the Cord.key - July 11, 2015 Networking

Let’s go back to a couple of tools we’ve added to our toolkit: • Apple’s Lightning to USB Camera adapter • Powered USB hub Let’s add a couple more items to our toolkit: • An Apple USB Ethernet Adapter for $29.00 • Ethernet cable

How does this all fit together?

1. First, plug the Camera adapter into the iPad. 2. Plug the USB hub into the Camera adapter. 3. Be sure to plug the USB hub into power. 4. Connect the USB Ethernet cable into the hub. 5. Connect the Ethernet cable to the USB Ethernet adapter. 6. Finally plug the Ethernet cable into the wall.

Simple!

21-7 iOS - Reconnect the Cord.key - July 11, 2015 Networking

Let’s go back to a couple of tools we’ve added to our toolkit: • Apple’s Lightning to USB Camera adapter • Powered USB hub Let’s add a couple more items to our toolkit: • An Apple USB Ethernet Adapter for $29.00 • Ethernet cable

How does this all fit together?

1. First, plug the Camera adapter into the iPad. 2. Plug the USB hub into the Camera adapter. 3. Be sure to plug the USB hub into power. 4. Connect the USB Ethernet cable into the hub. 5. Connect the Ethernet cable to the USB Ethernet adapter. 6. Finally plug the Ethernet cable into the wall.

Simple!

21-8 iOS - Reconnect the Cord.key - July 11, 2015 Networking

Let’s go back to a couple of tools we’ve added to our toolkit: • Apple’s Lightning to USB Camera adapter • Powered USB hub Let’s add a couple more items to our toolkit: • An Apple USB Ethernet Adapter for $29.00 • Ethernet cable

How does this all fit together?

1. First, plug the Camera adapter into the iPad. 2. Plug the USB hub into the Camera adapter. 3. Be sure to plug the USB hub into power. 4. Connect the USB Ethernet cable into the hub. 5. Connect the Ethernet cable to the USB Ethernet adapter. 6. Finally plug the Ethernet cable into the wall.

Simple!

21-9 iOS - Reconnect the Cord.key - July 11, 2015 Networking

Let’s go back to a couple of tools we’ve added to our toolkit: • Apple’s Lightning to USB Camera adapter • Powered USB hub Let’s add a couple more items to our toolkit: • An Apple USB Ethernet Adapter for $29.00 • Ethernet cable

How does this all fit together?

1. First, plug the Camera adapter into the iPad. 2. Plug the USB hub into the Camera adapter. 3. Be sure to plug the USB hub into power. 4. Connect the USB Ethernet cable into the hub. 5. Connect the Ethernet cable to the USB Ethernet adapter. 6. Finally plug the Ethernet cable into the wall.

Simple!

21-10 iOS - Reconnect the Cord.key - July 11, 2015 Networking

iPad to USB Camera Adapter to USB hub to USB Ethernet Adapter to Ethernet cable to Ethernet port

It sounds pretty convoluted… and it is!

What does this do!? Remember, the Lightning port on the iPad can’t power much more than a simple keyboard. So, we put a powered USB hub in mix and then connect this to a USB to Ethernet adapter, which connects things to Ethernet networks. The USB hub is not only supplying power to this chain of adapters but also passing network traffic from the network port in your wall to the iPad.

22 iOS - Reconnect the Cord.key - July 11, 2015 Networking

10.1.28.100

• Clear passcode • Clear restrictions • Wipe • Profit!

The end result is we’ve now put our iPad back on the network. It automatically obtains an IP address and we can send it remote commands such as “Clear Passcode”, “Clear a Restrictions passcode” and “Wipe Device” from our MDM server (Casper, Profile Manager or Meraki).

I keep this entire rig in a pouch in my bag and take it everywhere with me. If you want to what it looks like in person come see me after our session.

23 iOS - Reconnect the Cord.key - July 11, 2015 Networking

• Multiple iOS Device Setup • Ethernet switch • Caching server • iLife and iWork

This Ethernet rig isn’t useful for just sending commands. You can use multiple rigs connected to a Gigabit switch, which is connected to an OS X caching server, to enable simultaneous and dedicated high-speed app downloads when preparing devices for your users. You’ll notice the speed difference when installing large apps such as Apple’s iLife and iWork applications, which are hundreds of megabytes each.

On top of all this, you can connect your keyboard and barcode scanner to your USB hub at the same time! And everything works.

24 iOS - Reconnect the Cord.key - July 11, 2015 � Text Input � Networking ☐ Screen Recording ☐ Console and logs ☐ Command line tools

As I mentioned earlier, wired networking via the Lightning port has been available since roughly iOS 6. What’s new in iOS 8 and OS X 10.10 (Yosemite) is the ability to view and record what happens on your iOS device.

25 iOS - Reconnect the Cord.key - July 11, 2015 Screen Recording

Displaying an iOS screen on an Mac is a new feature Apple enabled for app developers so they could better demonstrate their apps. But nothing stops us from using that feature too.

Why would admins want to display an iPad screen on their Macs? Two words: Documentation and Support. And for folks like me, presentations.

Displaying or recording your iPad on your Mac requires OS X 10.10 Yosemite and iOS 8 devices with Lightning ports. This won’t work with 30- pin iOS devices. To record something from your iPad you’ll use the QuickTime Player application found in the Applications folder.

Once you see your iPad on your screen, you can click the red Record button to start and stop recording and you can even choose whether to record audio from your computer for narration or from your iOS device. Even if you’re not creating video documentation, you can still record your step-by-step instructions and then scrub through your recording and copy screen shots out of the video for print documentation.

26-1 iOS - Reconnect the Cord.key - July 11, 2015 Screen Recording

Displaying an iOS screen on an Mac is a new feature Apple enabled for app developers so they could better demonstrate their apps. But nothing stops us from using that feature too.

Why would admins want to display an iPad screen on their Macs? Two words: Documentation and Support. And for folks like me, presentations.

Displaying or recording your iPad on your Mac requires OS X 10.10 Yosemite and iOS 8 devices with Lightning ports. This won’t work with 30- pin iOS devices. To record something from your iPad you’ll use the QuickTime Player application found in the Applications folder.

Once you see your iPad on your screen, you can click the red Record button to start and stop recording and you can even choose whether to record audio from your computer for voiceover narration or from your iOS device. Even if you’re not creating video documentation, you can still record your step-by-step instructions and then scrub through your recording and copy screen shots out of the video for print documentation.

26-2 iOS - Reconnect the Cord.key - July 11, 2015 Screen Recording

Demo

Let’s see how this works. It’s simple to do: • Using your Lightning cable, connect your iPad to your Mac running OS X Yosemite. • Launch QuickTime Player found in the Applications folder. • Choose File > New Movie Recording. • From the Recording dialog, choose Camera from the dropdown menu and choose your iOS device.

If you’ve ever had to remotely support an IOS device, walk your customer through these steps to display it on screen and then use Apple Remote Desktop, VNC or any other software to watch what’s happening. This isn’t interactive—you can’t click buttons on your Mac to control the iPad but you can guide someone in real time and provide support without having to physically view the device.

27 iOS - Reconnect the Cord.key - July 11, 2015 � Text Input � Networking � Screen Recording ☐ Console and logs ☐ Command line tools

Now, let’s turn to some under-the-hood stuff.

28 iOS - Reconnect the Cord.key - July 11, 2015 Console and logs

OS X and iOS are both UNIX-based and share very similar Darwin kernels. While OS X allows us to peer into the workings of its system, iOS is pretty much a closed interface.

We can view OS X logs and real-time data using the Console application, Terminal, Activity Monitor and other utilities. The same activity we see there is also occurring on iOS devices. We just need to access it. How do we do that?

29 iOS - Reconnect the Cord.key - July 11, 2015 Console and logs

You may have downloaded and installed Xcode from the . If so, you already have what you need.

First, you’ll launch Xcode from the Applications folder and choose Devices from the Window menu. Next, plug in your iOS device and tap the Trust button when prompted to trust your computer. If you choose not to trust now, your iPad will prompt you again the next time you connect until you click Trust.

30 iOS - Reconnect the Cord.key - July 11, 2015 Console and logs

Xcode shows you basic information about your iPad such as name, model and iOS version.

If you click the Take Screenshot button, it’ll place a screenshot of your device’s screen on your Desktop. That could be handy when your screen is damaged and you need to see what’s happening.

31 iOS - Reconnect the Cord.key - July 11, 2015 Console and logs

If you click the View Device Logs button you’ll find something similar to what you’d see in the Console application on your Mac. On your iOS device these are mainly app crash logs. They’re not very helpful unless you know what you’re looking for.

32-1 iOS - Reconnect the Cord.key - July 11, 2015 Console and logs

If you click the View Device Logs button you’ll find something similar to what you’d see in the Console application on your Mac. On your iOS device these are mainly app crash logs. They’re not very helpful unless you know what you’re looking for.

32-2 iOS - Reconnect the Cord.key - July 11, 2015 Console and logs

If you click the View Device Logs button you’ll find something similar to what you’d see in the Console application on your Mac. On your iOS device these are mainly app crash logs. They’re not very helpful unless you know what you’re looking for.

32-3 iOS - Reconnect the Cord.key - July 11, 2015 Console and logs

What’s useful is the console output at the bottom of the window. This is tailing the active output of your iPad in real time.

It was very helpful when I was a troubleshooting Casper Focus issue within the school district earlier this year. Are folks familiar with Casper Focus? That’s JAMF Software’s tool for teachers to lock student iPads into an app or a website.

We had teachers reporting they’d remove focus from their students’ devices but a few often remained focus, which meant students weren’t able to use their iPads until we fixed them. Our initial thought was the wireless network was unreliable. After all, some devices worked but others didn’t. When I got my hands on one of these stuck devices and plugged it in to view the console, I was very surprised by what saw. The iPad was receiving the APNs command perfectly every time. It just wasn’t responding.

33 iOS - Reconnect the Cord.key - July 11, 2015 Console and logs

After reviewing the console information a little more I noticed the last line of the MDM output was “Server has no commands for this device.”

I still didn’t know what was happening but the evidence I collected helped me determine our Wi-Fi network was just fine and that I needed to be concentrating on our MDM server. This was something I could take to JAMF and ask them to help us troubleshoot further.

Eventually, JAMF implemented a new feature and fixed a bug to help us with this problem. They implemented a feature to send a remove focus command every time we clicked the Update Inventory button in our JSS and they fixed a bug so configuration profiles would properly timeout and expire, so that focus got removed anyway when we reached the end of our class times.

34 iOS - Reconnect the Cord.key - July 11, 2015 Console and logs

Xcode has a couple of drawbacks.

First, it’s huge—6 GB in size. It takes a long time to download and has a hefty footprint if all you need to do is look at your iPad’s console output. The other drawback is that it has no filtering capabilities like OS X’s Console application. You can’t just search for “mdmd”, which is the process I wanted to see when troubleshooting Casper Focus.

For routinely viewing iOS console information I recommend another item for your toolkit called “iOS Console” from LemonJar.com. It’s very lightweight—only 7 MB—and looks very much like OS X’s Console application. It even includes textual filtering to let you separate the useful data from the noise.

35-1 iOS - Reconnect the Cord.key - July 11, 2015 Console and logs

Xcode has a couple of drawbacks.

First, it’s huge—6 GB in size. It takes a long time to download and has a hefty footprint if all you need to do is look at your iPad’s console output. The other drawback is that it has no filtering capabilities like OS X’s Console application. You can’t just search for “mdmd”, which is the process I wanted to see when troubleshooting Casper Focus.

For routinely viewing iOS console information I recommend another item for your toolkit called “iOS Console” from LemonJar.com. It’s very lightweight—only 7 MB—and looks very much like OS X’s Console application. It even includes textual filtering to let you separate the useful data from the noise.

35-2 iOS - Reconnect the Cord.key - July 11, 2015 Console and logs

iOS Console

Download and use for free $14.00 to support the developer

iOS Console is a beta product and you can currently download it and use it for free on OS X 10.9.2 or higher.

You have the option to support the developer by paying $14.00 but that may become a requirement once it’s out of beta. Also, LemonJar does offer volume pricing for iOS Console.

36 iOS - Reconnect the Cord.key - July 11, 2015 � Text Input � Networking � Screen Recording � Console and logs ☐ Command line tools

Finally, let’s look at some command line tools that not only give us more information about our devices but also let us automate and control our devices. Keep in mind anything we can do in the command line is scriptable.

37 iOS - Reconnect the Cord.key - July 11, 2015 Command line tools

libimobiledevice

A cross-platform software protocol library and tools to communicate with iOS devices (including Apple TV) natively

http://www.libimobiledevice.org/

Let’s talk about an open source project called “libimobiledevice”. The development community started this project in 2007 (the same year the first iPhone was released) and released version 1.0 in 2010 (the same year the first iPad was released).

The intention was to develop tools for use on Linux to communicate with iOS devices. As of today, version 1.2 supports not only OS X and Linux but also Windows.

38 iOS - Reconnect the Cord.key - July 11, 2015 Command line tools

Libimobiledevice doesn’t use proprietary libraries and calls that Apple deems off-limits and it doesn’t require you to jailbreak your and iPads. Everything it does, it does so natively with both 30-pin and Lightning devices.

And as of early June, the website reports “Yes, libimobiledevice works with iOS 9.” (mostly)

39-1 iOS - Reconnect the Cord.key - July 11, 2015 Command line tools

10.06.2015: Yep, libimobiledevice works with iOS 9.

Libimobiledevice doesn’t use proprietary libraries and calls that Apple deems off-limits and it doesn’t require you to jailbreak your iPhones and iPads. Everything it does, it does so natively with both 30-pin and Lightning devices.

And as of early June, the website reports “Yes, libimobiledevice works with iOS 9.” (mostly)

39-2 iOS - Reconnect the Cord.key - July 11, 2015 Command line tools

/usr/local/bin/

idevice_id ideviceimagemounter idevicebackup ideviceinfo idevicebackup2 ideviceinstaller idevicecrashreport idevicename idevicedate idevicenotificationproxy idevicedebug idevicepair idevicedebugserverproxy ideviceprovision idevicediagnostics idevicescreenshot ideviceenterrecovery idevicesyslog

What does libimobiledevice do?

The places this list of binaries in your /usr/local/bin directory. The names are fairly self-explanatory but if you’re not sure what something does you can type the command and append “--help” to to the end.

40 iOS - Reconnect the Cord.key - July 11, 2015 Command line tools

/usr/local/bin/ideviceinfo --help

Usage: ideviceinfo [OPTIONS] Show information about a connected device.

-d, --debug enable communication debugging -s, --simple use a simple connection to avoid auto-pairing with the device -u, --udid UDID target specific device by its 40-digit device UDID -q, --domain NAME set domain of query to NAME. Default: None -k, --key NAME only query key specified by NAME. Default: All keys. -x, --xml output information as xml plist instead of key/value pairs -h, --help prints usage information

Known domains are:

com.apple.disk_usage com.apple.disk_usage.factory com.apple.mobile.battery ...

In this example, I’m running “--help” against the “ideviceinfo” command line binary.

One of the things I see I can do is use the “-q” or “--domain” switch to query a “domain” such as com.apple.mobile.battery.

41 iOS - Reconnect the Cord.key - July 11, 2015 Command line tools

/usr/local/bin/ideviceinfo --domain com.apple.mobile.battery

BatteryCurrentCapacity: 100 BatteryIsCharging: false ExternalChargeCapable: true ExternalConnected: true FullyCharged: false GasGaugeCapability: true

This returns information about the status of my device’s battery. In this example we get a list of six properties or keys and their values.

If all I wanted to retrieve were just the value for FullyCharged, I’d append to my command “--key” and the name of the key “FullyCharged” and the value returned is “false”. In other words, my device is reporting its battery is less than 100%.

42-1 iOS - Reconnect the Cord.key - July 11, 2015 Command line tools

/usr/local/bin/ideviceinfo --domain com.apple.mobile.battery

BatteryCurrentCapacity: 100 BatteryIsCharging: false ExternalChargeCapable: true ExternalConnected: true FullyCharged: false GasGaugeCapability: true

/usr/local/bin/ideviceinfo --domain com.apple.mobile.battery --key FullyCharged

false

This returns information about the status of my device’s battery. In this example we get a list of six properties or keys and their values.

If all I wanted to retrieve were just the value for FullyCharged, I’d append to my command “--key” and the name of the key “FullyCharged” and the value returned is “false”. In other words, my device is reporting its battery is less than 100%.

42-2 iOS - Reconnect the Cord.key - July 11, 2015 Command line tools

/usr/local/bin/ideviceinfo ... RegionInfo: LL/A SDIOManufacturerTuple: IOSDIOManufacturerID: 720 IOSDIOProductID: 17193 SDIOProductInfo: P=K94 m=1.0 V=a SIMStatus: kCTSIMSupportSIMStatusReady SerialNumber: DLXFD0JHDFHY SoftwareBehavior: EQAAAAAAAAAAAAAAAAAAAA== TimeZone: America/Chicago ...

Optionally, I could just run the ideviceinfo command without any switches to get all the information about the device itself. Again, this is returning a list of keys and their values.

43 iOS - Reconnect the Cord.key - July 11, 2015 Command line tools

/usr/local/bin/ideviceinfo --key SerialNumber

DLXFD0JHDFHY

If I wanted just the serial number of the device, I’d add “--key” and the key name SerialNumber.

44 iOS - Reconnect the Cord.key - July 11, 2015 Install Xcode command line developer tools

That should give you a taste of what the libimobiledevice tools can do. Where do you get them?

These are open source tools stored across Github repositories and you to compile them after downloading before you can install them. If you’re like me you’re not a developer and this can get a little hairy. Here’s a list of things to do.

First, you need to install the Xcode command line developer tools. These are a subset of that 6 GB Xcode application you can download from the Mac App Store. The easiest way to get these is to use the command line: “xcode-select -- install”. This goes out to Apple via Software Update and downloads and installs the tools.

45-1 iOS - Reconnect the Cord.key - July 11, 2015 Install Xcode command line developer tools

That should give you a taste of what the libimobiledevice tools can do. Where do you get them?

These are open source tools stored across Github repositories and you to compile them after downloading before you can install them. If you’re like me you’re not a developer and this can get a little hairy. Here’s a list of things to do.

First, you need to install the Xcode command line developer tools. These are a subset of that 6 GB Xcode application you can download from the Mac App Store. The easiest way to get these is to use the command line: “xcode-select -- install”. This goes out to Apple via Software Update and downloads and installs the tools.

45-2 iOS - Reconnect the Cord.key - July 11, 2015 Install Xcode command line developer tools

That should give you a taste of what the libimobiledevice tools can do. Where do you get them?

These are open source tools stored across Github repositories and you to compile them after downloading before you can install them. If you’re like me you’re not a developer and this can get a little hairy. Here’s a list of things to do.

First, you need to install the Xcode command line developer tools. These are a subset of that 6 GB Xcode application you can download from the Mac App Store. The easiest way to get these is to use the command line: “xcode-select -- install”. This goes out to Apple via Software Update and downloads and installs the tools.

45-3 iOS - Reconnect the Cord.key - July 11, 2015 Install full Xcode if installing iFuse

If you want to take advantage of iFuse, which is a sub-project of libimobiledevice for browsing your iPad’s folders and files, you’ll need to download the full Xcode software from the Mac App Store and run the application once to accept the license agreement and install the same command line tools.

If you’re not going to use iFuse, you only need to install just the Xcode command line tools.

46 iOS - Reconnect the Cord.key - July 11, 2015 � Install Homebrew

The easiest way to install libimobiledevice is to use a command line package manager called Homebrew. Homebrew will take care of downloading all the dependencies and creating the installers for us.

First, we need to install Homebrew. Next, we run “brew doctor”, which is Homebrew's self-diagnosis and cleanup tool. Finally, we copy the suggested command at the end and paste it back into the Terminal to run it. This adds the "/usr/ local/bin" path to our user profile so we can choose to simply type "brew" going forward.

47-1 iOS - Reconnect the Cord.key - July 11, 2015 � Install Homebrew

The easiest way to install libimobiledevice is to use a command line package manager called Homebrew. Homebrew will take care of downloading all the dependencies and creating the installers for us.

First, we need to install Homebrew. Next, we run “brew doctor”, which is Homebrew's self-diagnosis and cleanup tool. Finally, we copy the suggested command at the end and paste it back into the Terminal to run it. This adds the "/usr/ local/bin" path to our user profile so we can choose to simply type "brew" going forward.

47-2 iOS - Reconnect the Cord.key - July 11, 2015 � Install Homebrew

The easiest way to install libimobiledevice is to use a command line package manager called Homebrew. Homebrew will take care of downloading all the dependencies and creating the installers for us.

First, we need to install Homebrew. Next, we run “brew doctor”, which is Homebrew's self-diagnosis and cleanup tool. Finally, we copy the suggested command at the end and paste it back into the Terminal to run it. This adds the "/usr/ local/bin" path to our user profile so we can choose to simply type "brew" going forward.

47-3 iOS - Reconnect the Cord.key - July 11, 2015 � Download and install libimobiledevice dependencies

Next, we need to install some dependencies. These are libraries and files that aren't part of libimobiledevice but libimobiledevice needs them.

While this is installing, you'll notice a neat new little feature in Yosemite—it supports emoji! Look for the cute little beer mug!

48-1 iOS - Reconnect the Cord.key - July 11, 2015 � Download and install libimobiledevice dependencies

Next, we need to install some dependencies. These are libraries and files that aren't part of libimobiledevice but libimobiledevice needs them.

While this is installing, you'll notice a neat new little feature in Yosemite—it supports emoji! Look for the cute little beer mug!

48-2 iOS - Reconnect the Cord.key - July 11, 2015 � Download and install libimobiledevice dependencies

Next, we need to install some dependencies. These are libraries and files that aren't part of libimobiledevice but libimobiledevice needs them.

While this is installing, you'll notice a neat new little feature in Yosemite—it supports emoji! Look for the cute little beer mug!

48-3 iOS - Reconnect the Cord.key - July 11, 2015 Command line tools

Install Xcode command line tools from Apple:

xcode-select --install (or install Xcode)

Download and install Homebrew:

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/ Homebrew/install/master/install)"

/usr/bin/brew doctor

echo 'export PATH="/usr/local/bin:$PATH"' >> ~/.bash_profile

I'm not going to bore you with showing the entire install process, but it's pretty straightforward.

These are the commands to install the Xcode command line tools and Homebrew.

49 iOS - Reconnect the Cord.key - July 11, 2015 Command line tools

Use Homebrew to install libimobiledevice:

/usr/local/bin/brew install -v --fresh automake autoconf libtool wget libimobiledevice

/usr/local/bin/brew install -v --HEAD --fresh --build-from- source ideviceinstaller

Scripted install:

https://github.com/dayt0n/libimobiledevice-Installer/

sh ./libimobiledeviceInstall

And these are the commands to install libimobiledevice using Homebrew.

After spending hours researching and testing the correct sequence of commands to install all of this, a co-worker pointed me to the last item. You'll still need to install Xcode but this script runs everything else.

50 iOS - Reconnect the Cord.key - July 11, 2015 Command line tools

Install iFuse for browsing iOS files and folders:

http://sourceforge.net/projects/osxfuse/

brew install -v --HEAD --fresh --build-from-source ifuse

Install Java if prompted: https://www.java.com/en/download/mac_download.jsp

One more tool that's part of libimobiledevice but doesn't download and install with the rest of the utilities is iFuse. It lets you browse files and folders on your iOS devices.

After you've installed everything else, download the .dmg file and install Fuse for OS X and then use Homebrew to install iFuse. You may be prompted to install Java. Do that too.

51 iOS - Reconnect the Cord.key - July 11, 2015 Command line tools

/usr/local/bin/

idevice_id ideviceimagemounter idevicebackup ideviceinfo idevicebackup2 ideviceinstaller idevicecrashreport idevicename idevicedate idevicenotificationproxy idevicedebug idevicepair idevicedebugserverproxy ideviceprovision idevicediagnostics idevicescreenshot ideviceenterrecovery idevicesyslog ifuse

This adds the ifuse command line tool to /usr/local/bin.

52 iOS - Reconnect the Cord.key - July 11, 2015 Command line tools

Using iFuse:

$ mkdir ~/

Using iFuse is similar to accessing a disk via command line.

First, create a directory with any name you like. Here, I'll make a folder called 'ipad'. Next, Connect your iPad to your computer via its cable (this works for both 30-pin and Lightning devices). Run 'ifuse' followed by the name of your directory. iFuse locates any iOS device connected to your computer and mounts it to your folder.

Just like any connected disk, you can use 'ls' to list contents of your iPad.

53-1 iOS - Reconnect the Cord.key - July 11, 2015 Command line tools

Using iFuse:

$ mkdir ~/ipad $ /usr/local/bin/ifuse ~/ipad

Using iFuse is similar to accessing a disk via command line.

First, create a directory with any name you like. Here, I'll make a folder called 'ipad'. Next, Connect your iPad to your computer via its cable (this works for both 30-pin and Lightning devices). Run 'ifuse' followed by the name of your directory. iFuse locates any iOS device connected to your computer and mounts it to your folder.

Just like any connected disk, you can use 'ls' to list contents of your iPad.

53-2 iOS - Reconnect the Cord.key - July 11, 2015 Command line tools

Using iFuse:

$ mkdir ~/ipad $ /usr/local/bin/ifuse ~/ipad $ ls ~/ipad Books Downloads Photos Radio iTunes_Control DCIM PhotoData Purchases Recordings

Using iFuse is similar to accessing a disk via command line.

First, create a directory with any name you like. Here, I'll make a folder called 'ipad'. Next, Connect your iPad to your computer via its cable (this works for both 30-pin and Lightning devices). Run 'ifuse' followed by the name of your directory. iFuse locates any iOS device connected to your computer and mounts it to your folder.

Just like any connected disk, you can use 'ls' to list contents of your iPad.

53-3 iOS - Reconnect the Cord.key - July 11, 2015 Command line tools

Using iFuse:

$ cd ~/ipad/DCIM/100APPLE/ $ ls IMG_0001.PNG IMG_0002.PNG IMG_0003.PNG

You can also use 'cd' to change directories and 'cp' to copy files from your iPad to your computer.

This doesn't give you access to the root volume of your iPad. For that you would need to jailbreak your device because Apple's security model limits your access to the system. But you do get access to the data area of the iPad.

When you're done browsing files and folders, use the umount command to unmount the 'ipad' volume and use the rmdir command to delete the empty folder.

54-1 iOS - Reconnect the Cord.key - July 11, 2015 Command line tools

Using iFuse:

$ cd ~/ipad/DCIM/100APPLE/ $ ls IMG_0001.PNG IMG_0002.PNG IMG_0003.PNG

$ cp *.PNG ~/Desktop

You can also use 'cd' to change directories and 'cp' to copy files from your iPad to your computer.

This doesn't give you access to the root volume of your iPad. For that you would need to jailbreak your device because Apple's security model limits your access to the system. But you do get access to the data area of the iPad.

When you're done browsing files and folders, use the umount command to unmount the 'ipad' volume and use the rmdir command to delete the empty folder.

54-2 iOS - Reconnect the Cord.key - July 11, 2015 Command line tools

Using iFuse:

$ cd ~/ipad/DCIM/100APPLE/ $ ls IMG_0001.PNG IMG_0002.PNG IMG_0003.PNG

$ cp *.PNG ~/Desktop

$ umount ~/ipad $ rmdir ~/ipad

You can also use 'cd' to change directories and 'cp' to copy files from your iPad to your computer.

This doesn't give you access to the root volume of your iPad. For that you would need to jailbreak your device because Apple's security model limits your access to the system. But you do get access to the data area of the iPad.

When you're done browsing files and folders, use the umount command to unmount the 'ipad' volume and use the rmdir command to delete the empty folder.

54-3 iOS - Reconnect the Cord.key - July 11, 2015 Command line tools

Shell script:

#!/bin/sh

TYPE=$( ideviceinfo -k ProductType ) OSVERSION=$( ideviceinfo -k ProductVersion ) SERIALNUMBER=$( ideviceinfo -k SerialNumber )

if [[ -f ~/Desktop/inventory.txt ]] ; then echo "$TYPE\t$OSVERSION\t$SERIALNUMBER" >> ~/Desktop/inventory.txt else echo "Type\tiOS Version\tSerial Number" > ~/Desktop/inventory.txt echo "$TYPE\t$OSVERSION\t$SERIALNUMBER" >> ~/Desktop/inventory.txt fi

exit 0

Let's look at some scripting examples. Keep in mind that my life for the past year has been working in K-12 education, so I’m using examples from that realm.

Scenario: You inherit a cart of iPads from a classroom and you need to get a quick inventory. The teacher has been kind enough to reset all of them before sending them to you and they're waiting for you to run through the setup assistant.

You could tap the glass and run the setup assistant on each iPad and then choose Settings > General > About to get most of this information. Or you could use the ideviceinfo tool in a script to read the information and send it to a tab-delimited file. In this case, the teacher did you a favor by resetting the devices because they won't prompt you to trust your computer. The trust is stored in the network settings of each device but those network settings don't yet exist.

All you need to do is plug in a device, run the script and unplug the device. It'll take you longer to plug and unplug each device than it will to actually run the script. You can have a spreadsheet of your 25 iPads in about two minutes.

55 iOS - Reconnect the Cord.key - July 11, 2015 Command line tools

AppleScript:

set userApps to do shell script "/usr/local/bin/ideviceinstaller -l | awk '{ print $1 }'"

set AppleScript's text item delimiters to ", "

set appsList to words 2 through end of userApps

repeat with anApp in appsList set removeCommand to "/usr/local/bin/ideviceinstaller --uninstall " & anApp as string do shell script removeCommand end repeat

set AppleScript's text item delimiters to ""

Here's an AppleScript and can be saved as double-clickable applications.

Scenario: You inherit a cart of iPads from a classroom and you need to quickly turn it around for an iPad training session in one hour. At least you were actually given advance notice this time, right? The iPads aren't wiped but they have an assortment of apps installed. You want to remove all apps except those that come with the iPad (in other words, remove all user-installed apps).

This script uses the "do shell script" command in AppleScript to run "ideviceinstaller", which can list apps, install apps upgrade apps and remove apps. We use it to first list all user-installed apps and create a list. Then we recurse through the list and remove each app. Just a few seconds per device.

56 iOS - Reconnect the Cord.key - July 11, 2015 Command line tools

Shell script:

#!/bin/sh

# create backup SERIALNUMBER=$( /usr/local/bin/ideviceinfo -k SerialNumber ) /bin/mkdir -p ~/Desktop/Backups/$SERIALNUMBER /usr/local/bin/idevicebackup2 --full backup ~/Desktop/Backups/$SERIALNUMBER /usr/local/bin/idevicebackup2 unback ~/Desktop/Backups/$SERIALNUMBER

# delete photos /bin/mkdir /private/tmp/iosdevice /usr/local/bin/ifuse /private/tmp/iosdevice ; sleep 2 /bin/rm -R /private/tmp/iosdevice/DCIM/* /bin/rm -R /private/tmp/iosdevice/PhotoData/* /sbin/umount /private/tmp/iosdevice /bin/rmdir /private/tmp/iosdevice

# shut down the device /usr/local/bin/idevicediagnostics shutdown

Finally, this shell script takes advantage of a few of the tools.

Scenario: A class has just finished with a set of iPads it was using to take pictures. You want to backup the iPad's data (just in case), delete all the pictures and then shut down the devices until they're needed for next time.

The idevicebackup2 tool creates a backup to a location you specify on your computer and it then restores the files to make the files readable. We use iFuse to remove the photo data. And then use the idevicediagnostics tool to shut down the iPad.

57 iOS - Reconnect the Cord.key - July 11, 2015 Screen Recording

Demo

Let's see the script in action.

I'll use my iPad to take three pictures of the room.

For the sake of convenience, I'll use BBEdit's feature to run this script. Since I don't have much on this iPad, it takes less than a minute to complete.

First, note that my iPad shut down. If we browse the unpacked backups files, we should find our photos in the DCIM folder.

58 iOS - Reconnect the Cord.key - July 11, 2015 � Text Input � Networking � Screen Recording � Console and logs � Command line tools

Today, we discussed a couple of methods for entering text such as simple keyboards and barcode scanners with barcode fonts. The more complex setups used powered USB hubs, which allowed us to also network our iOS devices.

New in Yosemite and iOS 8 is the ability to display an iPad's screen on our Mac, make videos and capture screen shots. Don't forget this method is also useful for remote support when you can't directly view an iPad.

We looked at how to get diagnostic and forensic information from an iPad using Xcode or iOS Console. And finally, we touched on the libimobiledevice toolset for reading information, sending commands and demonstrated how those tools could fit into larger scripted projects.

59 iOS - Reconnect the Cord.key - July 11, 2015 Q&A

60 iOS - Reconnect the Cord.key - July 11, 2015 William Smith 318, Inc. Santa Monica, CA [email protected] http://talkingmoose.net @meck iOS - Reconnect the Cord Feedback: http://j.mp/psumac2015-89

61 iOS - Reconnect the Cord.key - July 11, 2015