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
How to edit Finder Preferences using the terminal?
Change default view style in Finder window
1 |
defaults write com.apple.finder FXPreferredViewStyle -string "Nlsv"; killall Finder |
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
1 |
defaults write com.apple.finder ShowMountedServerOnDesktop -boolean true; killall Finder; |
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
1 |
defaults write com.apple.finder ShowHardDrivesOnDesktop -boolean true; killall Finder; |
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
1 |
defaults write com.apple.finder ShowExternalHardDrivesOnDesktop -boolean true; killall Finder; |
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
1 |
defaults write com.apple.finder ShowRemovableMediaOnDesktop -boolean true; killall Finder; |
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
1 |
defaults write NSGlobalDomain AppleShowAllExtensions -boolean true; killall Finder; |
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
1 |
defaults write com.apple.finder FXEnableExtensionChangeWarning -boolean true; killall Finder; |
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
1 |
defaults write com.apple.finder FXEnableRemoveFromICloudDriveWarning -boolean true; killall Finder; |
This command is executed to display a warning dialog box before removing items from the iCloud drive.
Expand information window panes
1 |
defaults write com.apple.finder FXInfoPanesExpanded -dict General -bool true OpenWith -bool true Privileges -bool true; killall Finder |
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
1 |
defaults write com.apple.finder _FXSortFoldersFirst -boolean true; killall Finder |
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
1 |
defaults write com.apple.finder AppleShowAllFiles -boolean true; killall Finder |
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
1 |
defaults write com.apple.finder ShowStatusBar -boolean true; killall Finder |
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
1 |
defaults write com.apple.finder _FXShowPosixPathInTitle -boolean true; killall Finder |
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.