How to scan your Mac for 32-bit apps

Tuesday April 17, 2018

Feature head image

Much has been written about the up-coming switch to a 64-bit-only macOS (see Apple’s support document here). This also means that apps have to be 64-bit to run in the next version of macOS.

You can see what apps currently running on your system are 32-bit by opening Activity Monitor (you’ll find it in the Utilities folder of the Applications list in Finder), and then ensuring the CPU tab is selected. Then right-click on the column headings and select Kind from the list. A new column will be added at the right of the column listed, but you should now be able to use it to order the list by 32- and 64-bit apps.

But what about finding what 32-but apps lurk on your system? Surely you don’t have to run each and every one to find out which are 32-bit?

No, you don’t. One way to check is to open System Information, which is one of the macOS built-in diagnostic tools. Just hold down the Option key and click the Apple menu at the top left of the screen, then select the app’s entry at top of the menu. In the app window that appears, click the Applications heading under the Software heading at the left, and then select any app you’re interested in within the list at the top right. Look at the heading 64-Bit (Intel) beneath. If this reads No then the app is 32-bit.

Main feature illustration

This takes time, though, and it’s not always easy to understand which app is being talked about. A better method would be to scan the system for 32-bit apps and produce a list. For this you can use the latest version of the Etrecheck system information tool. Use it to scan your system and then when it’s finished, in the results window, click Minor Issues at the left, and select the Review button alongside the 32-Bit Apps heading.

System and underlying third-party app components are reported in Etrecheck’s list alongside actual apps, but on my system Apple’s own DVD Player app, and a lot of the Adobe Creative Cloud tools, were reported as being 32-bit. Some very popular apps like the script writing tool Final Draft and the text editor TextWrangler are also reported as being 32-bit.

Curiously, I see a warning when running TextWrangler but not when running Final Draft. My guess would be that Etrecheck is reporting that some components of an app are 32-bit, rather than the entire thing being 32-bit.

(Note that Etrecheck blocks users taking a screenshot so the illustration below is taken with an iPhone camera. Blocking screenshots is a pretty dumb thing for Etrecheck to do, in my humble opinion.)

Main feature illustration


Leave a comment...

How to open Sharepoint cloud Office files directly via Finder (OneDrive for Business/Microsoft Office 365)

Monday April 16, 2018

Feature head image

Update May 2018: It appears that the Office 2016 apps on Mac now automatically do what’s described below, so this fix is no longer necessary. If you open a file in your OneDrive folder via Finder, the relevant Office app (Word, Excel, PowerPoint) will now automatically activate the AutoSave switch, and you can share/co-edit with others without a second thought. However, I’ll leave this post here for those for whom this feature doesn’t work correctly — or in case Microsoft ever remove or switch-around this feature.

=-=-=-=-=-=-=-=-=-=-=-=-=-=

Recent releases of Microsoft Office 2016 for Mac have been integrated pretty tightly with the cloud. Unfortunately, if you access your Microsoft Office files using Finder – as most of us do – there’s no way to open cloud files directly. You merely open a local version of the file. Features like live editing with colleagues aren’t available.

Until now. Read on to learn how.

The problem
For an Office 365 business user working within a larger business, “the cloud” equates to Sharepoint cloud integration – or OneDrive for Business, as it’s also confusingly known.

There’s a switch at the top left of Word, Excel and PowerPoint that activates autosaving to the cloud, and a Share button at the top right that means you can quickly provide a link so colleagues can access the file too. A new file open/save dialog box in Office apps offers “Online Locations”, and so features Sharepoint/OneDrive for Business integration.

Feature image

This is great if you only ever open Sharepoint files using the Office apps’ Open File dialog box. But Microsoft’s done almost zilch to integrate Sharepoint access into the rest of macOS and Finder. The OneDrive app will sync your Sharepoint/OneDrive for Business files to your Mac’s hard disk, but if you double-click to open any of them via Finder then you’re only opening the copy on your hard disk. You are NOT opening the Sharepoint copy in the cloud. This means the autosave and share features don’t work.

It can be very confusing. If you click the Share button you’re immediately prompted to “move” or “copy” the file to the Sharepoint cloud to make it available to colleagues. But surely it’s actually already there…?! However, unless you copy or move the file you aren’t able to share it.

Wouldn’t it be better just to be able to open the Sharepoint cloud file within the Office docs, simply by double-clicking it within the OneDrive listing of macOS’ built-in Finder?

Here’s how.

This is a bit of a hack using AppleScript, so comes without warranty or guarantee. But it works for me. (The search and replace subroutine in the code comes from the Mac OS X Automation site, with thanks.)

It’s worth briefly mentioning (so that I don’t get hundreds of comments below) that it’s sometimes possible to setup a webdav connection to Sharepoint so you can access the files via Finder. However, many institutions have implemented two-factor authentication, which makes that impossible. And some companies just turn off this feature anyway.

What we’re going to do
You’re going to want to setup this trick if you share a lot of files with colleagues via the cloud for simultaneous editing, or to avoid sending copies via email (and receiving hundreds of copies back). It’s means you can actually use Microsoft Office in the cloud, as Microsoft would like you to.

And to do this, I’m going to tell you how to create your own DIY handler app to open Sharepoint cloud files.

In a split second this little app checks to see if the file you’ve just double-clicked in Finder is in your OneDrive folder. If it ISN’T then it’s opened as usual within the Office app, just as it would be normally. If the file IS within OneDrive then the little app instructs the Office app to open the Sharepoint cloud version instead of the file on your hard disk. However, any edits you make to the cloud file will still be near-instantly synced to your hard disk thanks to the OneDrive for Business app.

Notably, for all this to work you’ll need to be logged into Sharepoint/OneDrive for Business within each of your Office apps (that is, Word, Excel and PowerPoint). This can be done using the File > Open dialog box, clicking the Online Locations dialog box, and then clicking Add a Place. Then click the OneDrive for Business option, and provide your login details.

Gathering information
You’ll need to discover two things before starting. The first is the file path to your OneDrive folder. This will probably be something like:

/Users/username/OneDrive/

… And yes we need to include that trailing slash at the end when writing this down, and when inserting it into the code later on. “username” will your your Mac username. If you work for a company the file path might be something like /Users/username/OneDrive – Corporation PLC/.

One trick is to open a Terminal window, and drag and drop a file from the OneDrive folder on top of it. You’ll then see the path you need to note. Just remove the filename from the end.

Next, you need to know your personal Sharepoint path that matches the OneDrive folder. In other words, if you view whatever is at the Sharepoint path you’ll see exactly what you see when you view the OneDrive folder on your computer.

One way to discover this is to visit the Sharepoint folder in the File Open dialog box of any of the Office apps, then right-click any file and select Share > Copy Path. Then paste within a word processor. You should see the path listed there, and again you can just trim away the filename at the end. Alternatively, ask your IT person if they can help.

Whatever you end-up with will look something like the following:

https://example-my.sharepoint.com/personal/johnsmith/Documents/

… or if your organisation hosts its own Sharepoint server it could look something like this:

https://sharepoint.example.com/personal/johnsmith/Documents/

Creating the handler apps
Here are the steps required to create the handler apps. This need only be done once, obviously.

  1. Open Script Editor, which you’ll find in the Utilities folder of the Applications list in Finder.
  2. Click New Document at the bottom left of the file open dialog box.
  3. Click File > New two times, so that you now have three empty Script Editor windows.
  4. Save each of the new files you’ve created in your Documents folder, or another safe location where you know they won’t be deleted. Call the first one Word Sharepoint Handler, the second Excel Sharepoint Handler, and the third PowerPoint Sharepoint Handler. When saving each, select “Application” from the File Format dropdown list.
    Feature image
  5. In the Word Sharepoint Handler window, paste in the following code – you can select all of this at once, and just paste it right into Script Editor. Once you’ve pasted, click the little hammer icon on the toolbar to check the code – if it instantly color-codes without an error then it’s fine:

    on open theDroppedItems
    set originalFilename to POSIX path of theDroppedItems
    if originalFilename contains "OneDrive" then
    set newFilename to replace_chars(originalFilename, "ONEDRIVE-PATH", "SHAREPOINT-PATH")
    do shell script "open -a 'Microsoft Word' " & quoted form of newFilename
    display dialog "Fetching from Sharepoint and opening... " & newFilename buttons "I'm waiting..." giving up after 3
    else
    do shell script "open -a 'Microsoft Word' " & quoted form of originalFilename
    end if
    end open
    on replace_chars(this_text, search_string, replacement_string)
    set AppleScript's text item delimiters to the search_string
    set the item_list to every text item of this_text
    set AppleScript's text item delimiters to the replacement_string
    set this_text to the item_list as string
    set AppleScript's text item delimiters to ""
    return this_text
    end replace_chars
  6. In the code above, replace ONEDRIVE-PATH with the OneDrive path you discovered earlier (e.g. something like /Users/johnsmith/OneDrive/), and replace SHAREPOINT-PATH with the Sharepoint path you discovered (e.g. something like https://example-my.sharepoint.com/personal/johnsmith/Documents/). Don’t delete any quote marks from the code!Feature image
  7. Repeat the above step for the Excel handler window, pasting in the following and entering your OneDrive and Sharepoint paths:

    on open theDroppedItems
    set originalFilename to POSIX path of theDroppedItems
    if originalFilename contains "OneDrive" then
    set newFilename to replace_chars(originalFilename, "ONEDRIVE-PATH", "SHAREPOINT-PATH")
    do shell script "open -a 'Microsoft Excel' " & quoted form of newFilename
    display dialog "Fetching from Sharepoint and opening... " & newFilename buttons "I'm waiting..." giving up after 3
    else
    do shell script "open -a 'Microsoft Excel' " & quoted form of originalFilename
    end if
    end open
    on replace_chars(this_text, search_string, replacement_string)
    set AppleScript's text item delimiters to the search_string
    set the item_list to every text item of this_text
    set AppleScript's text item delimiters to the replacement_string
    set this_text to the item_list as string
    set AppleScript's text item delimiters to ""
    return this_text
    end replace_chars
  8. In the PowerPoint handler window, paste in the following replacing the OneDrive and SharePoint paths:

    on open theDroppedItems
    set originalFilename to POSIX path of theDroppedItems
    if originalFilename contains "OneDrive" then
    set newFilename to replace_chars(originalFilename, "ONEDRIVE-PATH", "SHAREPOINT-PATH")
    do shell script "open -a 'Microsoft PowerPoint' " & quoted form of newFilename
    display dialog "Fetching from Sharepoint and opening... " & newFilename buttons "I'm waiting..." giving up after 3
    else
    do shell script "open -a 'Microsoft PowerPoint' " & quoted form of originalFilename
    end if
    end open
    on replace_chars(this_text, search_string, replacement_string)
    set AppleScript's text item delimiters to the search_string
    set the item_list to every text item of this_text
    set AppleScript's text item delimiters to the replacement_string
    set this_text to the item_list as string
    set AppleScript's text item delimiters to ""
    return this_text
    end replace_chars
  9. Save all the files, and close Script Editor.
  10. macOS’ security feature might block you using your new apps. Therefore, you now need to tell the Gatekeeper security feature that the apps are OK to open in future. This only needs to be done once. Authorise the first of your apps by right-clicking it in Finder, then selecting Open, and selecting Open in the dialog box that appears. Nothing will appear to happen when you do this! That’s fine. But repeat this step for the other two apps.

  11. Next, find a Microsoft Word file anywhere on your hard disk (that is a .docx file), and right-click it. Select Get Info from the menu that appears.
  12. In the dialog box that appears, click the dropdown list beneath Open With, and then click Other at the bottom of the list that appears. Then navigate to your new Word Sharepoint Handler app in the Documents folder (or wherever you saved it). Select it. Back in the Get Info dialog box, click the Change All button. Close the Get Info dialog box.
    Feature image
  13. Repeat the above step for Excel files – that is to say, find an Excel file, right-click it, and switch over the Open With association to the Excel Sharepoint Handler app you created. Repeat again for a PowerPoint file.

Your handler apps should now work. Test them by opening a file within your OneDrive folder. You should find you open the Sharepoint cloud version instead – it’ll probably take a few seconds for the file to be downloaded, and you’ll notice the Autosave switch at the top left of the Office app window is activated.

Try opening a file outside the OneDrive folder. You should find it opens normally, as it did before you setup the handler apps.

If you want to undo any of the above, repeat the steps to change the file associations and then select Microsoft Word, Excel and PowerPoint for each of the Office filetypes. Then simply delete the handler apps you created.

There are some slight irritations with this method. One of them is that Office files lose their Word, Excel or PowerPoint icons. This can be fixed, but I haven’t detailed that here. The other is that opening a file in Sharepoint takes a few seconds even for the smallest file, because it’s cached from the cloud. For larger files such as big presentations it can take a long time. This is partially why I added the display of a dialog box to the code – I wanted the user to know that something had been kicked-off. You just have to know to be patient if nothing appears to be happening.


Leave a comment...

MacBook Pro shutting down when asleep? Here's why

Tuesday October 24, 2017

Feature head image

I’ve had long term issues with my MacBook Pro shutting down in sleep mode. Other times I’ll open it and find it’s incredibly hot, with the fans blowing. The problem seems to have been magnified with the installation of High Sierra. I’m not alone: Some people had started calling this the “sleep of death”.

After resetting the SMC and NVRAM (both of which I advise as first steps for this issue), I experimented by turning off Power Nap. This is a relatively new feature on portable Macs that lets them perform some tasks – such as fetching emails, or applying updates – while the system is in sleep mode (that is, usually with the lid shut).

By turning off Power Nap the problem appears to have been fixed. In one case at least, consulting the system log showed that the crash and subsequent shutdown occurred when the system attempted to backup via Time Machine – again triggered by Power Nap. The Time Machine disk was getting full, and it seems my Mac’s response to this error message was to, well, give-up and turn itself off.

Turning off Power Nap is pretty simple – open-up System Preferences, click the Energy Saver icon, and then remove the check in the Power Nap box for both the Battery and Power Adapter tabs.

Power Nap is one of those features that’s nice to have, but hardly essential, and I’m not missing it at all. YMMV but see how to you get on if MacBook Pro sleep mode crashes or heat-ups are an issue for you.

Main feature illustration


Leave a comment... [1]

New command-line tools in High Sierra

Sunday October 1, 2017

Feature head image

Here’s a list of the differences between the main command-line tool listings in High Sierra compared to its predecessor Sierra. What’s new? What’s gone? Here you can find out.

There are not very many new tools, and none seem vital from an everyday-usage perspective. Perhaps of most interest is the removal of the command-line ftp and telnet programs – although surely this was a long time coming considering how insecure these are.

There’s also a new yaa archive filetype that I can’t find any information about online. But take a look at the list see what you think. If you can provide more info of any of the tools then share the info in the comments below.

To get this information I simply diff’ed the file listings of /bin, /sbin, /usr/sbin and /usr/bin on Sierra and High Sierra – these being listed in the $PATH for a standard macOS user (/usr/local/bin/ is also listed, but does not exist within a default install of macOS).

To compare the contents of the paths, I used a virtual machine with a fresh Sierra installation, and then updated it to High Sierra. Notably, the Xcode command-line tools were NOT installed, and nor were any third-party command-line managers like brew. It’s possible a virtual machine installation doesn’t install certain services common to an actual bare-metal installation of macOS. Therefore some command-line tools might be missing from this list.

In each case I’ve provided the summary in the man page for that command, or the description that appears when you type the command followed by ––help.

Additions
Here’s the new tools provided within High Sierra. See later in this blog post for tools that have disappeared.

/bin & /sbin
All filenames identical.

Contents of /usr/bin

AssetCacheManagerUtil
Control the macOS content cache (from AssetCache manpage: “AssetCache speeds up the download of software and content distributed by Apple by locally caching assets that were previously downloaded on your network. AssetCache is launched automatically by the system. Users should not run AssetCache manually.”) MacKungFu note: This is part of the new caching server provided with the client macOS installation, and which was formerly part of macOS Sierra Server.)

diagnose-fu
This tool generates files that permit Apple to investigate issues with the disk and storage configuration of your device and to help improve related Apple products.

dmc
Configures the Disk Mount Conditioner. The Disk Mount Conditioner is a kernel provided service that can degrade the disk I/O being issued to specific mount points, providing the illusion that the I/O is executing on a slower device.

ktrace
ktrace can configure the system to trace events, or record them to a file, and print a human-readable representation of the events.

yaa
yaa creates and manipulates YAA archives. MacKungFu note: I can’t find this archive file format mentioned anywhere online. Bizarre.

Contents of /usr/sbin

bluetoothd
The Bluetooth daemon handles SDP transactions, link key management, and incoming connection acceptance. It cannot be used directly by the user. (MacKungFu note: the older blued is no longer in High Sierra but is present in Sierra.)

ckksctl
Control and report on CKKS (MacKungFu note: Appears to be CloudKit-related.)

skywalkctl
skywalkctl is a utility used to interact with the Skywalk subsystem, which provides the plumbing between various networking-related pieces of software and hardware. It should only be used in a test and debug context. Using it for any other purpose is strongly discouraged.

wfsctl
The wfsctl utility allows administrators to start, stop, and check the status of the WebDAV File Sharing service (WFS). It also allows administrators to create and delete WebDAV share points. It operates by configuring the Apache httpd server. The wfsctl command requires root privileges.

Tools removed from High Sierra
Here are the tools in Sierra that have been removed from High Sierra. Note that I have not included tools that have been removed but that are still actually present with updated version numbers.

/bin & /sbin
As above, all filenames are identical.

Contents of /usr/bin

AssetCacheActivatorUtil
Control the macOS caching server.
c_rehash
Utility to verify certificates. The verify command verifies certificate chains.
ftp
Internet file transfer program. ftp is the user interface to the Internet standard File Transfer Protocol. The program allows a user to transfer files to and from a remote network site.
gnuattach
Server and Clients for Emacs
gnuclient
Server and Clients for Emacs
gnudoit
Server and Clients for Emacs
gnuserv
Server and Clients for Emacs
telnet
User interface to the TELNET protocol. The telnet command is used to communicate with another host using the TELNET protocol.
testrb
No man page but it’s part of the Ruby on Rails framework.
tethered-caching
In its first form, tethered-caching creates a tethered network, starts a caching service, and prepares all tethered iOS devices to use that network and caching service. The caching service in macOS Server is configured and started if macOS Server is installed on this computer.

Contents of /usr/sbin

apxs
apxs is a tool for building and installing extension modules for the Apache HyperText Transfer Protocol (HTTP) server.
blued
The Mac OS X Bluetooth daemon.
timed
The timed utility is a time server daemon which may be invoked at boot time via launchd.
timedc
The timedc utility is used to control the operation of the timed program.


Leave a comment...

◀︎ Older /
Recently on MKF