How to zoom into photos down to pixel level on iOS

17 March 2017, 02:03

Feature head image

Here’s a neat little trick that lets you overcome the iPhone/iPad’s deliberately limited pinch-expand zoom. It lets you zoom into images right down to individual pixels.

Start by opening the picture you want to zoom in on. Tap the edit button, as indicated below…

Main feature illustration

… then tap the rotate/crop button. Tap to rotate the image 90 degrees, then tap Done.

Now repeat all the above, but this time rotate the image back to the way it was (that is, you’ll need to tap the rotate button three times). Tap Done.

Main feature illustration

You will now be able to zoom into the image via the pinch-expand gesture, and will be able to keep going all the way down to pixel detail – although the pixels will be blurred because of the way iOS handles zoom.

Note that this only works for as long as you have the picture open for viewing. If you close it, and then open it again, the usual zoom limitation will be applied again and you’ll have to repeat these steps if you want pixel-level zoom.

Leave a comment...

Kill all logging in macOS Sierra – and (maybe) save battery life

16 March 2017, 10:00

Feature head image

A few days ago I blogged about how to deactivate runaway logging for certain apps and processes in macOS, something which seems to be a very recent problem introduced with the macOS Sierra update. It has been known to consume increasing amounts of CPU time, making the fans spin-up and gobbling-up battery life on portable Macs.

Below are the steps required to turn off, as much as is possible, all app and process logging in macOS Sierra. Again, I have to point out that this only turns off logging and as such is utterly harmless. You’re not quitting any apps or processes, or hindering them in any way.

I have to admit that this is an effective but ultimately hacky solution for turning off logging but I’m unable to find any other way of achieving it (and certainly not an “official” method – I don’t believe Apple ever intended anybody to turn off logging, even though 99.99% of users do not need it or are unaware of it).

The benefits of turning off most app/process logging might include significantly improved battery life. This is what I believe I’ve experienced, in any event. Let me know in the comments below what your findings are.

What we’re going to do
The steps below aren’t for beginner users, and consist of two main components. The first is a script that simply runs through virtually all possible process IDs (PIDs), and upon finding a PID that matches an actual app or process, summarily kills its logging. Just before quitting the script deletes any existing log files to free-up disk space. The second part of the hack involves a launchd plist that causes this script to run each time the Mac boots, and every 30 minutes subsequently. It runs in the background, invisibly, and is set to have the least possible impact on your system. In other words, you shouldn’t be aware it’s there aside from the fact that using the Console app should show significantly fewer entries.

Nonetheless, you do need to remember the hack is in place. Apple might fix the whole runaway logging problem in an update of macOS, for example, making it redundant. Or you might actually need the diagnostic data that logging provides in order to solve a problem with your computer. I also provide instructions below detailing how to deactivate this hack.

Remember: These steps only work on macOS Sierra (and possibly later releases of macOS). They will NOT work on earlier version of OS X, which used a completely different logging system.

The steps required
Here are the steps required:

  1. Open the Terminal app, which you’ll find in the Utilities folder of the Applications list of Finder.

  2. Copy and paste the following into the Terminal window, entering your login password when prompted. You might see a scary-looking warning message but this is fine and you can continue. Note that this is a single line of code even though it might appear as several lines in your browser – just triple-click any line to select the whole thing, then Cmd+C to copy it, before hitting Cmd+V to paste it into the Terminal window:
    sudo curl -L > /usr/local/bin/;sudo chmod +x /usr/local/bin/

  3. In the Terminal window type whoami, and then select and copy the result.
    Main feature illustration

  4. In the Terminal window, type the following, which will open the script for editing in the Terminal window:
    sudo nano /usr/local/bin/

  5. Using the cursor keys, move the text cursor to the very bottom line. See the word USERNAME? Delete this, and then paste in what you copied in Step 3. For example, on my system where my username is keir, this is how that last line in the file looked:
    rm -rf /Users/keir/Library/Logs/*

  6. In the Terminal window tap Ctrl+O, hit Enter, and then Ctrl+X. This will save the file and close the text editor. Note that you’re using the Ctrl key there, not the Cmd key!

  7. Copy and paste the following into the Terminal window – again it’s a single line of code, so triple-click etc.
    sudo curl -L > com.mackungfu.kill-logging.plist;sudo cp com.mackungfu.kill-logging.plist /Library/LaunchDaemons/;rm com.mackungfu.kill-logging.plist

  8. Finally, type the following to activate everything (again, this is a single line of code):
    sudo launchctl load -w /Library/LaunchDaemons/com.mackungfu.kill-logging.plist

You can now close the Terminal window. The log killing background service is now running, and will restart upon every boot of the computer.

Should you want to turn off the logging killing service, paste the following into Terminal (which again is a single line):

sudo launchctl unload -w /Library/LaunchDaemons/com.mackungfu.kill-logging.plist

If you want to remove the scripts added previously, paste in the following (again a single line of code):

sudo rm /usr/local/bin/; sudo rm /Library/LaunchDaemons/com.mackungfu.kill-logging.plist

Problems with this method
As you might realise if you implement the steps above, this is not a perfect solution. Any apps or processes that launch between instances of the script running in the background will not be blocked from spewing log output. Some launch, spew log output for a few minutes, and then quit. However, the script will eventually run again on its 30 minute cycle so any long term offenders should get caught and dealt with. Additionally, because Safari treats each new browser tab as a separate process, a big issue is that Console log output will fill quickly once more with masses of* log output, and the method above doesn’t address this. However, in stopping most other log output, the benefits are still very significant.

Main feature illustration

Many thanks to Jon H for creating the bash script used here.

Leave a comment...

Turn off runaway logging on macOS

14 March 2017, 10:00

Feature head image

Since the release of macOS, which features a new logging system, some people have reported certain apps going crazy with the massive amount of log writing they do. This can get so bad that the Mac gets hot because it’s working so hard to write the data. Typically the log is viewed in the Console app, which you’ll find in the Utilities folder of the Applications list.

(If you don’t know what logging is in the context of computing, Wikipedia can help.)

All existing information you might find online about turning off or otherwise controlling OS X/macOS’s logging is now obsolete, thanks to the changes in macOS. Therefore, below are the steps that do actually work in order to turn off logging for any particular app or process. I haven’t yet found a way to turn off logging entirely, for all apps and the entire system, and my guess would be this is impossible because Apple’s engineers didn’t believe it would ever be necessary. However, if you know of a way then please let me know in the comments below.

  1. Open a Terminal window, which you’ll find in the Utilities folder of the Applications list within Finder.
  2. Using Console, as discussed earlier, find the name of the runaway logging process or app. In the Terminal window type pgrep -il, and then the name of the app or process. For example, if the process was touchui then I would type the following:
    pgrep -il touchui 
  3. Make a note of the number alongside the process in the results (this number is know as the process ID, or PID). Note that the results might include extraneous entries that you can ignore. If nothing appears, try searching for just part of the name of the app or process – to continue the example above, you might search just for touch.
  4. In the Terminal window paste in the following, before typing the number you discovered earlier:
    sudo log config --process=
  5. After typing the number, hit Space and then paste in the following:
    --mode "level:off"
  6. The line you end-up with should look something like the following (which is a single line even though it may appear on two lines in your browser). In my example the number returned by the pgrep command for my errantly logging app was 65:
    sudo log config --process=65 --mode "level:off"
  7. Hit Enter, and type your login password when prompted. You might see a serious-looking warning. Don’t worry about it.
  8. The results will take effect instantly, and you can close the Terminal window. From this point on, and until you reboot, the runaway logging app’s log output will not be logged.
Main feature illustration

It’s very important to note here that you’re merely turning off log output for that particular app or process. You aren’t killing the app or process itself, or hindering how it runs in any way.

To turn logging back on for that app or process it’s easiest to simply reboot the computer but if that’s not possible then the following should do the trick. You’ll need to replace PID after ––process with the number you discovered earlier:

sudo log config --process=PID --mode "level:default"

Leave a comment... [2]

How to get working an old Mac you've received

7 March 2017, 10:27

Feature head image

Somebody is either given a dirty old Mac, or buys one from a thrift store, and they have absolutely no information about it. It might be bootable. Sometimes the disk has been wiped, or all you see is a scary boot time icon. In most cases the urge is to start again with a clean installation of the operating system. Complicating the situation is that this new Mac owner has little experience of them. A vital fact is that Macs just don’t work like Windows PCs when it comes to installing the OS.

Does this sound familiar? Then read on.

Using Internet Recovery
Most Macs since around 2010 have featured Internet Recovery and this is the most direct route to getting a fresh installation of the operating system on the computer. There’s also something called Recovery Mode, but if the disk has been wiped then this might not be present, so I advise Internet Recovery. Notably, Internet Recovery will install the version of the OS X/macOS that the computer came with when first purchased, and often this is optimised for that machine (and you can always upgrade later). It’s also one of the only ways to actually install that particular operating system version because Apple typically only makes available the latest versions for upgrade purposes.

Obviously, for Internet Recovery to work you’ll need to be within range of a standard internet-connected Wi-Fi signal, and also know the Wi-Fi password. Apple lists all the computers that are compatible with Internet Recovery but, of course, you might not know the make and model of your Mac, so this could be moot. Just give a try and see what happens.

To boot into Internet Recovery mode, boot the computer and, before the Apple logo appears or you hear the chime, hold down the Cmd+Option+R keys (in some countries this will be Cmd+Alt+R).

If you see the following padlock image on the boot-time screen…

Main feature illustration

… then I’m sorry but it’s game over at this point because this means Mac has a firmware password. If you don’t know this password then you can’t do much apart from boot the computer to its existing operating system. You might try creating a bootable USB stick to install an operating system while the computer’s booted-up, but that’s outside the scope of this article.

Note that, to my knowledge, it’s impossible to crack a Mac’s firmware password. That doesn’t stop many scammers saying they can, however, so be careful should you google this issue.

UPDATE: It transpires there might be a way of resetting the firmware password on Macs manufactured before 2009. It involves disassembly of the computer, however.

If you don’t see the firmware password request then you should find yourself prompted to join a Wi-Fi network, and following this the operating system recovery partition will be downloaded. This might take a while.

Main feature illustration

Formatting the disk
After this you should see a menu offering various options, including installing OS X/macOS, but don’t jump into that just yet! Instead, click to start the Disk Utility app. Once that’s up and running, select the main partition on the left of the Disk Utility window – the one that’s slightly indented from the header showing the name of the disk drive – and click the Erase button. You’ll then be prompted to give the new partition you’re creating a name, and ensure you select “Mac OS X Extended (Journaled)” from the dropdown list beneath. If there’s a third drop down menu beneath this ensure you select “GUID Partition Table” (or “GUID Partition Map”) and not MBR, as you might with Windows or Linux.

Once your new partition is created, close Disk Utility (click Disk Utility > Quit) and this will return you to the previous menu. Select to install Mac OS X/macOS. At this point you might be prompted for an Apple ID and password. If you have an existing one that you use, such as one used on your iPhone or iPad, then use that rather than creating a fresh one. This is important because not all Apple IDs are equal and those already in use – and that have already downloaded apps, for example – have superpowers that are useful here. However, if you don’t have an Apple ID then you’ll need to sign-up for one.

Installation from this point should be straightforward. If you run into any issues, post them below ensuring you complete the email address field too, and I’ll attempt to get to back to you.

Installing Windows or Linux
You might be tempted to forgo the OS X/macOS experience and just install Windows or Linux. After all, a modern Intel Mac is just a PC in other clothing… right? Surely you can just jam in a bootable Windows/Linux USB stick? Sadly, no. You might be able to boot from the USB stick (hold down Option/Alt at boot to see the boot-time menu), but the EFI boot ROM in a Mac is different compared to a PC, and you can’t simply install Windows or Linux without first using the Boot Camp utility, which is built-in to OS X/macOS. This means you’ll need to have a working OS X/macOS installation.

Really old Macs
If you end-up with a really old Mac – like the fruit-colored iMacs or clamshell iBooks – then Internet Recovery won’t work. The best bet for these computers is to source the original installation CDs/DVDs, which you might be able to do via eBay. Alternatively, you might find in one of the many online Mac communities that somebody will create disks for you. There’s a lot of excellent resources out there if you do end-up with a vintage Mac, and they can be surprisingly usable.

Leave a comment...

◀︎ Older /
Recently on MKF
/ Newer ▶︎