A few Mac tips

At the risk of the blind leading the blind…

  • An OS X GUI application is conventionally ‘bundled’ or put into a special directory structure whose root has an .app extension (see here and scroll down for Apple’s documentation on what the structure actually entails). In Finder (the OS X equivalent to Windows Explorer), right click on an application’s icon and select Show Package Contents to inspect this structure.
  • One irritation with Finder (at least for me) is that you can’t show hidden files and directories with it [update: without issuing a long command to Terminal and reopening Finder – check out the comments]. As a workaround, I’ve installed the open source muCommander. It’s not the most elegant-looking thing ever written, but it does the job – and it’s not like you have to stop using Finder as a general purpose file manager.
  • Another Finder irritation is it dumping .DS_Store files everywhere, even on network shares (these files are the rough equivalent of Windows Explorer’s desktop.ini). As documented here, this can be fixed by issuing the following incantation  command to Terminal (the OS X equivalent to the Command Prompt on Windows):
    defaults write com.apple.desktopservices DSDontWriteNetworkStores true

    After doing that, you will probably have to either reboot or log out and in again for the change to actually have effect. Unfortunately, I haven’t found a way to stop Finder outputting .DS_Store files on USB sticks.

  • If you’re looking for a plain text editor and TextEdit (the OS X equivalent of both Notepad and Wordpad) doesn’t suit your needs, check out TextWranger. This is fast and light, with a pretty interface that includes (along with many other languages) Object Pascal syntax highlighting, built-in code folding for procedural bodies, and a ‘jump to’ combo box at the top. Alas, there is one caveat: by ‘Object Pascal’ it probably means not the language of Delphi or FPC, but the older Apple dialect. This leads to apparent oddities like ‘class’ not being recognised as a keyword.
  • I probably shouldn’t be, but I’m still surprised at how somewhat Linux-y open source stuff on Windows isn’t available on the Mac (or, er, Linux!). One example is 7-Zip. Happily, Keka does the trick for decompressing existing archives.
  • If you’re looking for a Mac equivalent of Dependency Walker (Depends.exe), check out MacDependency. You run it, it shows on the Dock, then you drag and drop executable and dylib files to it (dylibs are the equivalent to DLLs on Windows).
  • When a program has hung, right click on its Dock icon to find an option to forcibly terminate it. Unfortunately, I haven’t found this command to be as effective as the Windows Task Manager equivalent [update: others have plainly had better experiences though, as the comments show!]. For times when that is the case, the command line comes to the rescue: open up Terminal, and type top -u [enter] to get a list of processes. Find the process to terminate, take a note of its numerical process identifier (PID) in the left-most column, and press q to quit the listing application. Next, type sudo kill -9 PID [enter] , where PID us the number just noted. If this is the first time you’ve used sudo in the terminal session, they’ll be a prompt to enter your administrator password (i.e., a UAC prompt in Windows terms). Also, in the case of an XE2 application hung during debugging, the process to terminate will probably be the debugger (dbkosx_16_0) rather than the program itself, simply because the debugger will keep the program alive in a zombie state.
  • Having made the dubious decision to try out Lazarus on my Mac, I quickly found I wanted to assign the .pas file extension to TextWrangler instead. Finder then played a few games with me until a bit of Googling came to this solution: right click on a .pas file, select Get Info, then select the desired application via the ‘Open with’ combo box before clicking ‘Change All’. Note that ‘All documents like this one’ turns out to mean merely ‘all documents sharing this file’s extension’ – there doesn’t appear to be any built-in grouping beyond that.

8 thoughts on “A few Mac tips

  1. Some extra info from other blind user:
    1) you can see hidden files in finder:

    2)Agree about DS_Store files… I hate them, and there is no way I know to stop them going into any usb usb drive you open with finder.

    3) I prefer Ipackr (you can get from the app store) to keka, as it allows me to open zip files without uncompressing them (as you can in windows).

    4) To kill an app, press “alt” after (or while) right clicking. The “Quit” entry in the menu will be changed to “Force Quit”. The alt key is a global modifier in many places of the OS, it is worth trying in many places. For example, if you “alt click” the wifi icon in the menu bar, it will show an extended menu with useful information.

    Besides “alt-force quit”, I normally have “activity monitor” in my dock, which works as the windows task manager, and you can kill a process from there too. (“activity monitor” comes with osx, just press ctrl-space to activate spotlight and type it, then keep it in the dock changing its icon to show the Cpu usage).

    Finally, as a last resource when the GUI is completely unresponsive and you can’t kill an app because screen is frozen, “cmd-alt-escape” works kind of like ctrl-alt-del in windows, showing you a list of apps that you can kill. I have recovered from completely “dead” state by killing the dock with this method.

  2. Rather than dropping down to the console/terminal to kill a hung process you can use the equivalent of Task Manager..

    Finder > Utilities > Activity Monitor

    Find the hung process in the list then “Force Quit”. For myself the Finder Dock “Quit” option generally doesn’t do anything the first time around on a hung process but then – on the rare occasion(s) that it has happened, the next time I pull up the menu for the docked item, it now reads “Force Quit”, and does work.

    I was initially frustrated that I couldn’t use Finder for all things file related, but once i realised that the console/terminal was a *proper* command processor, unlike the impotent excuse we have to put up with in Windows, I decided/realised that Finder was perfectly good enough for doing those things and working with those files that *should* have GUI ease of use/access, and that having to drop down to the terminal for certain things was in fact A Good Thing.

    It acts as a reminder that what you are doing is probably much higher risk than usual and to exercise caution.

    imho. ymmv

    • “Rather than dropping down to the console/terminal to kill a hung process”

      As I said in the post, I have found the Unix command to be effective where the GUI one fails miserably. What can I say other than that has been my experience?

      “unlike the impotent excuse we have to put up with in Windows”

      The modern command processor on Windows is PowerShell, where your criticisms don’t apply. That said, for myself, I still like the old DOS commands for simple things – anything more complicated, and I usually write a throwaway Delphi application.

    • Urgh, no. This was for when ‘force quit’ *doesn’t work* – I’ve tried to edit the first sentence to make this clearer, though I still think it was pretty clear to begin with. I’ve had this a couple of times when either the XE 2 remote debugger crashes or Thunderbird hangs. If the UI option always works for you, then great…

  3. The Finder add-on “TotalFinder” is a great little utility that will solve the issue you have with Finder (.DS_Store, hidden file toggle), plus adds tabbed browsing, a dual pane view that can be toggled on/off, sort file listing with folders at the top, and a few others. It’s inexpensive too. http://totalfinder.binaryage.com/

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s