How Do I Create Context Menu Items in Mac Finder?

Posted on

As the users who have previously dealt with Windows may know, it’s really easy to create new files in the apps in this OS. All you have to do is to right-click the mouse – and next moment the respective context menu pops up. It’s even possible to add some extra items to such a menu. Unfortunately, you can’t do the same trick in MacOS or an OS X. The process of adding new context menu items on Mac is somewhat more complicated, but you definitely can go through it knowing the right way. In this article, you will find detailed step-by-step instructions for creating a new item in context menu in Mac Finder.

Create Mac Context Menu

In case all you need is simply to be able to create new files in just a few clicks, we can recommend you New File Menu – an app developed specifically for creating new files via the context menu in the Finder. Download the app from the AppStore and follow the simple instructions, to get all the work done for you. Just in a few minutes after installation, you will be able to enjoy one of the most popular and useful features and create new files in Finder instantly.

However, for a somewhat more complicated process of adding new items into the context menu, you need to know the chain of commands which make it possible. Further, we are going to introduce you to the way of the manual adjustments and adding new context menu items with the help of the inbuilt Mac app Automator.

RELATED POST: Fast & Effective Mac App Memory Clean

Adding new context menu items in the Mac Finder with Automator

In the following instruction, we’ll take a menu item which lets to unrar an archive as an example. Perform the steps described below to add a new item to the context menu of the Finder:

  1. Go to Applications, and open the Automator app.
  2. In the popped-up menu bar, click File and New.
  3. In Service, choose the type of the document.
  4. Find the top panel in the right pane. In the first drop-down, click Files and Folders. In the second drop-down, choose Finder.app.
  5. In the actions pane at left, click Run Shell Script.run Shell Script
  6. Once you can see the box of the Run Shell Script in the pane on the right, change the value of the Pass Input to To Arguments.
  7. At this point, you can finally write any shell script to your choice, as now you receive the arguments of a file as $@. Look through an example of a script (unrar’ing archived files here).
  • First, enter the directory of the first file: current_path = $ (put the dirname ‘$1’). Cd is ‘$ current_path.’
  • Unrar every file to the current directory:

for f in ‘$@’ do – /usr/local/bin/unrar X ‘$f’ – done.

  • Exit 0, to prevent the errors from happening.
  1. You can check again, to make sure that the file has the appropriate extension.
  2. To save the changes, done in the Automator, click File and Save. The displayed name of the new context menu will be the same as the one you save the performed task as.

Test and debug the new item in the context menu

You can test a new task in the Automator, and debug it by simulating a real use situation and adding extra actions to the task. For the example described above, the action Get Specified Finder Items will allow to select a file and check out how the new action works.Get Specified Finder Items

Next, Automator will be sending you the error & success messages while running a task. A regular context menu is not always able to do that. Once you are satisfied with a task working the right way in Automator, delete all the temporary actions for debugging that were created.

right-click on fileUse the new item in the context menu

Go to Finder and right-click on any file or folder (.rar files in this example). Then click Services and (the name of your task).

The task will be performed in the background. That’s it.