Category filter

Script to customize Finder Preferences on Mac

Finder is the gateway to every file, folder and application on the Mac. Customizing the Finder Preferences to complement the users’ needs is one of the most efficient ways to enhance their experience. For instance, if the device is being prepared to connect to multiple other Macs within the network, the user may or may not want the connected servers displayed on the desktop. Another user may like their files and folders displayed in the list view over the column view. Features like these, which may seem insignificant but can make quite a difference in the user experience, can be modified via Finder Preferences. But doing so manually on each device is not feasible. Given below are scripts to customize Finder Preferences on Mac. Use Hexnode UEM’s Execute Custom Script action to implement them remotely.

Scripting Language – Bash

File extension – .sh

Disclaimer:


The sample scripts provided below are adapted from third-party open-source sites.

How to edit Finder Preferences using the terminal?

Change default view style in Finder window

This command can be used to change the default view style of files and folders in the Finder window. You can choose one of the following view styles:

  • Nlsv – List view
  • icnv – Icon view
  • clmv – Column view
  • flwv – Cover flow view

Show connected servers on desktop

Macs can connect to other servers in the same network. Execute this command to display the servers that your Mac is connected to on the desktop.

Show hard disks on desktop

Usually, to view Mac’s hard disks, you would have to navigate to Applications > Utilities > Disk Utility. You can execute this command to display Mac’s hard disks on the desktop.

Show external disks on desktop

When an external disk is connected to a Mac, it is displayed in Finder’s sidebar under Locations. Run this command to display them on the desktop as well.

Show removable media on desktop

When removable media like CDs, DVDs or iPods are connected to Macs, they are displayed under Locations in the Finder window. Execute this command to list them on the desktop as well.

Show all filename extensions

Generally, only the names of items are displayed in the Finder window. For example, an app named ‘Reminders’ is displayed as Reminders, and a text file named ‘Hello’ is displayed as Hello. This command can be executed to display the extension of each item along with its name. For instance, once the command is executed, the items mentioned above will be displayed as Reminders.app and Hello.txt, respectively.

Show warning before changing file extensions

This command is executed to display a warning dialog box before changing the extension of a file.

Show warning before removing items from iCloud drive

This command is executed to display a warning dialog box before removing items from the iCloud drive.

Expand information window panes

When you control-click (right-click) on any item in the Finder window and choose the Get Info option, an information window opens. This window contains various panes, which can be expanded by clicking on the triangles next to it. ‘General’, ‘Open with’, and ‘Sharing & Permissions’ are a few of them. This command can be used to have these panes expanded by default.

Keep folders on top when sorting by name

When sorting the contents by name, all the files are listed first and then the folders or vice versa. On executing this command, the folders will be sorted first.

Show hidden files

Specific files in your Mac are hidden by default for privacy and security purposes. Running this command will let you display these otherwise hidden files in the Finder window.

Show status bar

The status bar at the bottom of the Finder window displays the number of items in the current folder and the available disk space. Use this command to make the status bar visible.

Show full path in Finder title bar

When a folder is opened, just its name is usually displayed on the Finder window’s title bar. However, you can execute this command to display its entire address path instead.

Notes:

  • It is recommended to manually validate the script execution on a system before executing the action in bulk.
  • Hexnode will not be responsible for any damage/loss to the system on the behavior of the script.

  • Sample Script Repository