How To Find Out What’s Locking Files or Folders in Mac

One of the first problems that I came across the Mac was the “File in use” error that occurred whenever I tried to unmount a hard drive, or unmount a USB thumb drive. It was annoying because I didn’t know how to find the source. In Windows, I would face the same problem too, but I had a program that I used to tell me the offending application. It was handy because it would show me what exactly was locking up my file, and I could unlock/remove its hold.

On the Mac, I had to search for something that offered the same functionality, and I found it in the form of a terminal command:

sudo lsof | grep -i

Basically, the command will look for your filename in the list of open processes, and display all relevant information about it on screen. I find this unwieldy though, so I searched around somemore and found a GUI replacement to this terminal command! It’s called What’s Keeping Me, and it does what the terminal command does, except in a pretty GUI.

whats keeping me screenshot

So now you can find out what’s keeping a file locked on the Mac. Go grab What’s Keeping Me now – it’s donationware, so you can use it for free, and make a donation if you find it useful. Go to the What’s Keeping Me website.

​Read More

How To Open Documents With Windows Applications On Mac OS (Using VMWare Fusion)

I love VMWare Fusion, because it allows me to run Windows applications on my Mac seamlessly. It gets to the point that I want some forms of documents to always open with Windows applications. For instance, I don’t like Mac Office, and would rather use Windows Office to open my Office documents. The problem was that when you go to “Get Info” in Finder, some of the Office applications wouldn’t be listed.

vmware fusion for mac

I solved this by searching for where the applications were located, and found them in this path:

~/Documents/Virtual Machines/

Select the machine that you want (it’ll look like .vmwarevm), and then right-click on it, and choose “Show Package Contents”. When you’re inside, go to the Applications folder, and you’ll see all your applications there.

Now that you know where the applications are, you can either create a link and place them where you want (e.g. in your ~/Applications/ folder), or whenever you do a “Get Info” on a document, you can choose to open all files in the future with those applications (by browsing to that location, and selecting the appropriate application).

​Read More

How To Print The List of Files in a Folder on the Mac

Sometimes you just need to print out the list of files in a particular folder. While I was on Windows, sometimes I’d just take a screenshot of the folders’ contents, but when I had to print it out or when the folder’s contents were too much, I had to use a third-party software just to accomplish this.

On the Mac, you have Automator! Automator allows you to get the contents of any folder on your Mac. With the contents, you can save it as a text file so you can print, copy, or do whatever with it.

Here’s 5 easy steps to list your folder contents on a Mac:

  1. Open Automator
  2. Create a new workflow
  3. Drag: Ask for Finder Items (Change “Type” to Folder)
  4. Drag: Get Folder Contents
  5. Drag: New Text File (Choose your filename and location)
  6. Hit “Run”

And voila! Your folder contents are saved to a text file, ready to be used.

Tip: You can search for your actions, e.g. search for “folder”, and you should see the “Get Folder Contents” displayed.

​Read More

How To Batch Unzip A Series of Sequential Zip Files In Mac OSX

I recently got a bunch of zip files, some sequential (X1.zip, X2.zip, etc), and others not. The thing is, they number in the hundreds, and most contain RAR files within them, and simply extracting each one won’t do. I had to find an automated way to unzip all the zip files, and the utility that i usually use (BetterZip) didn’t seem to help.

Finally after trying a few methods (including the unzip command in Terminal), I found this method that was relatively straightforward and quick. In the folder that contained all the zip files that I wanted of a particular series, I would select all of them, and open them in Finder. This will execute the default Archiver unextract command, and you’ll have a bunch of folders now, which will each contain the contents of their individual zip files.

In that Finder window, search for “.rar” and you’ll see the list of RAR files that you’ve extracted. Now select all of them, and copy them to another folder. Now you can extract all of them at once.

That’s it! Hope this helps.

​Read More

How To Enable Macros With A Password-Protected Workbook in Microsoft Excel 2007

Well, guess what, you can’t. Microsoft Office 2007. A brand new way to create frustration in your life.

microsoft excel 2007

I was trying to create a macro in Microsoft Excel 2007 and nearly tore out my hair. The thing with macros in Excel 2003 was that it was relatively easy to accomplish, but it’s a whole different ballgame in Excel 2007. Here’s an account of what I did, only to discover that there’s no sane way to have macros run in Excel 2007.

So firstly, my setup: I’m using Excel 2007, and I’m on Windows XP SP 2.

I created an Excel workbook, and thinking that newer is better (Oh so wrong), I chose to create it under the new Excel 2007 format. Then I wrote my basic macro in that workbook, tested it, and all was fine. However, the workbook contained sensitive information, so I wanted to password-protect it. So I encrypted the file, choosing to have it prompt for a password before it would open.

Once that was done, I saved and closed the file as a macro-encrypted workbook in the trusted folder location that I supplied. Like any other normal person, I re-opened the file immediately to see if everything worked. I was actually almost 100% certain that nothing would go wrong. Hoho if only I knew.

I was surprised with a message in the message bar saying that the macro has been disabled. There was the Options button on the message bar, so I clicked that, and was faced with a prompt that said:

“This file contains macros that have been disabled because there is no antivirus software installed that can scan them. To run these macros, remove the encryption or permission restrictions on the file”

At this point, you’re given a comprehensive list of choices that allow you to resolve this issue in the most efficient manner possible. Well, actually, I wish. You’re just given a radio button list of ONE choice that says, “Help protect me from unknown content (recommended)”. Well it looks like it’s not only recommended, but it’s the only option.

So I meddled around, and lost about one year of my life in frustration and annoyance. My meddling led me to the Trust Center, where apparently I thought I had to put my macro in a trusted location. “Okay, for the sake of better security,” I thought. So I made these changes:

  • Message bar: “Show Message Bar in all applications when content has been blocked”
  • Macro settings: “Disable all macros with notification”

Looking at that, I had the impression that I should get some notification if Excel blocks something (Oh so wrong again).

I also figured that I should also add a trusted folder location in the Excel trust center. So I go add my current working directory to it. A little bit annoying, but if it means better security, I guess it’s okay right? (Oh so wrong – it doesn’t do crap).

When I opened the Excel workbook, I immediately noticed that macros were silently disabled. Remember how I set the Trust Centre settings above to show some notification? Well yeah, no notifications, nothing on the message bar at all, and I couldn’t find any way to enable macros.

Weird, I thought. So I used the Developer tab (some newfangled contraption only found in the fabulous Excel 2007), and tried to run the macro that I created. But, whoops! You’ll see this message: “Because of your security settings, macros have been disabled. To run macros, you need to reopen the workbook, and then choose to enable macros.”

Well, that’s weird, because I just opened the workbook and I was NOT given any choice to enable macros. So why was the message telling me to enable macros??

So, let’s summarise:

  1. If you try to run a macro-enabled Excel workbook (an xlsm file) in a location that is not trusted, you are told that macros have been disabled, and you can’t enable them.
  2. If you put that workbook in a trusted location, your macros are silently disabled.


The conclusion then? In Excel 2007, you can’t have a workbook with usable macros if it’s encrypted with a password. The ONLY way that I found was to save the workbook under Excel 2003.

I hope this has saved somebody some grief and frustration.

​Read More

Edit .htaccess to increase PHP’s max file upload

To increase the upload file size limit on your website, you need to edit PHP’s configuration settings. Unfortunately, not everyone has their own web server, so most of the time people are constrained by the limits of shared hosting. But you can still modify your base php.ini file by creating your own php.ini with the edits that you want.

Your php.ini file needs to be in every folder that’s going to be affected, or at least in the folder where the php script is being called from. Unfortunately if you have dozens of folders that need this edit, then you’ll need dozens of php.ini files.

An alternative is to then use .htaccess. By just placing a.htaccess file in your root folder, all folders beneath it will also have the change. The code to change your PHP max file upload size is:

RewriteEngine On
php_value post_max_size 1000M
php_value upload_max_filesize 1000M
php_value max_execution_time 6000000

You can edit it to suit your needs. 1000M = 1GB, so edit accordingly. Do note that your host will need to allow PHP edits though.

​Read More