Sierra brings new ways to manage the cramped storage on your Mac, including surrendering all files to your iCloud overlords. All portable Macs now only use smaller and faster SSD storage, so optimizing available space is more important than ever.

Automated storage management is just as useful on a desktop Mac to ensure you aren’t backing up and maintaining loads of files you don’t need. Whether you want to use the cloud or take matters into your own hands, here’s how macOS Sierra can help lighten the load.

Click Here to Save Space: Automated Storage Optimization

Mac Sierra Storage Cleanup

Access storage optimization via About This Mac in the Apple menu in the top left corner. Click on Storage to see the current usage of your drive, broken down by types of file. In Sierra, you can click on Manage to get automated tools that can help you save space.

The first page is Apple’s list of recommended steps to save on space for your Mac. We’re going to skip this area for now, and instead, focus on each category on the left-hand side. Note the bottom two categories — Other Users and System — are grayed out even if you’re are signed in with your admin account.

Mac Sierra Application Cleanup

Applications gives you a list of all the installed applications on the system. Under Kind, it will tell you if the app is from the App Store, as well as if it’s an older version of an app or a duplicate install.

Most apps can be deleted right from this menu, though it does seem that Steam games will need to be removed via the Steam app. There’s a nice feature here where the menu will tell you if an App has never been used.

Mac Sierra Documents Cleanup

The next option is a similar menu, Documents. This pane has three options: Large Files, Downloads, and File Explorer. The first panel will give you a list of the largest files on your drive. You can delete those you no longer need. Downloads is your downloads folder from Finder, just centrally located. The final option is just Finder, sorted for the size of the folders and files.

Review and Act: Storage and Clean Up Tips

The next few options are read-only, but you can find out how much space GarageBand, iCloud Drive, and Mail are currently taking up on your drive. On the Recommendations screen you can use the Optimize Storage command to remove downloaded email attachments from old messages.

Related:  What Training Do Apple Technicians Need to Fix iOS & Mac Devices?

To clean up iCloud storage, you’ll need to go to the iCould Drive folder in Finder. Garageband is a bit tougher to manage. You get the total of the space your loops and lessons keep up, but no way to delete them. If you’ve already removed the app, you’ll need to dig around in the library to delete all the files. They are located here:

  • Macintosh HD/Library/Application Support/GarageBand
  • Macintosh HD/Library/Application Support/Logic
  • Macintosh HD/Library/Audio/Apple Loops

Mac Sierra Trash Cleanup

The final panel is Trash. This will show you all of the files in your Trash folder. Double check everything you have here and click Empty Trash.

Trust in the Cloud

If there is a new feature in Sierra that has people worried, it’s the iCloud Storage Optimization. Apple sells the feature as one where you simply check a box and iCloud magically uploads your documents when your Mac’s disk gets close to capacity. The problem is that there isn’t a way to know what Apple considers “near capacity.”

Related:  Microsoft Pays You to Ditch Your MacBook for a Surface

You can’t exclude files that you want to always keep locally, so there may be a chance that the presentation you’re working on for your trip isn’t available when your Mac can’t access the internet. As long as you know the risks, or aren’t able to keep that many things local to your Mac, let’s move forward with enabling the feature.

Mac Sierra iCloud Optimize

Open System Preferences and click on iCloud. Next to iCloud Drive click the Options button. The radio button to turn on the feature is at the bottom of the window. Click Done, and you’re set. Everything else is handled automatically.

I have Sierra installed on a test machine for now, and that has around 75 GB of free space, and that didn’t trigger anything going up to iCloud. But since the behavior isn’t predictable, make sure you double check any documents you’ll need to have local. Consequently, it seems like this feature needs a bit more time to bake.

Related:  How the Mac Option Key Can Give You More Menu Options

Don’t forget you’ll need some iCloud storage in order to use this feature, it’s unlikely the 5 GB you get for free will cut it.

Roll Your Own 1: Scripting and Automator

Though the iCloud implementation is a nice way to automate cleaning up your disk space, not everyone can or wants to move their documents to the cloud. Whether you have a home NAS or a network drive at work that you want to move your older files to, we can do that with some pretty easy scripts.

This breaks down into two different parts: a logon script to automatically mount your network drive, and a daily script that will move files unmodified for 90 days to your network drive.

Related:  What to Do When an App Freezes in Mac OS X

The first thing we are going to do is set up shortcut folders, called symlinks, pointed at a network drive. In this case, we are using an FTP server, but you could just as easily use a local NAS, or the SMB shared drive in your office. You will need to change the code slightly for those alternate methods to match the format you use.

There are different commands for the various types of drives that you are trying to mount, for example, SMB is mount -t smbfs.

Mac Sierra Automator App

Open Automator and select Application. In the search box type shell to pull up the Run Shell Script action, drag that into the application area. Under cat, add the following code and enter your information for the SSID and the user directory:

currentNetwork=$(networksetup -getairportnetwork en0)
if "$currentNetwork" == "Current Wi-Fi Network: Your_Home_Network_SSID" ; then
	if ! -d mkdir /users/your_username/old_docs; then
		mkdir /users/your_username/old_docs
	fi
	/sbin/mount -t ftp "ftp://user:password@ftpaddress/target_directory/users/your_username/old_docs
fi

Run it to make sure that all of your syntax and connections are correct. Save the Application and add it to you log in items. The script runs at log in, and checks if your Mac is connected to your home network. Then it will check to see if the old_docs folder exists in your user folder, and if it doesn’t it will create that folder. Then it will mount your FTP server directory to the old_docs directory.

Our next step is to create a second Automator workflow, this time choose the CalendarAlarm option, and choose the Run Shell Script action again. This time we’re going to create the code that looks for documents older than thirty days and moves them to the symlink we created after logging in, paste the following code in and update it to match your target folders:

for file in $(find ~/Documents/*.* -atime +30); do
	desName=$(basename "$file")
	mv "file" "/users/your_username/old_docs/$desName"
done

myFolders=$(find ~/Documents/* -type d)
for folder in $myFolders; do
	for file in $(find $folder -atime +30); do
		desName=$(basename "$file")
		folderName=$(basename "$folder")
		mv "$file" "/users/your_username/old_docs/$folderName/$desName"
	done
done

Before this works, there are a couple of things you’ll want to do. First, we’re going to create a mirror of the directories in your Documents folder on your destination drive. If you’ve got some coding skills you can add a check that creates the directory as well, but I was trying to keep this as lightweight as possible. Second, I would clean up files that you have that have spaces, as BASH gets weird about spaces in file names.

Let’s take a look at how this works. The first for loop gets all the files in your Documents folder that you haven’t accessed in 30 days. The files pass to a command called basename to just keep the file name to copy it to the destination path. It then creates an array of all the directories in your Documents folder. It steps through that array and uses it to create another find command with the same logic, using that basename command on the folder and file names to then construct a command to move those files as well.

Related:  5 Easy Ways to Infect Your Mac With Malware

Run the workflow to do the initial clean up, and then save the workflow. A prompt will come up to name the alarm. After you name the file, Calendar will open with the initial alarm. Edit the event to set it as a repeating event once a month, and it might be better to set it sometime in the middle of the night.

Roll Your Own 2: Automator Solo

If you’re allergic to messing around with Bash, and you’re not concerned about keeping the folder structure; you can use an Automator Alarm to do something similar with a single Calendar event. Note that you cannot do the recheck that you’re on your home network, so this workflow will confirm that you want to perform that backup.

You find that by adding Ask for Confirmation, then add the text you’d like. Next, search for Get Specified Servers and drag it into the workflow. Click Add and follow the prompt to mount your network drive.

Mac Sierra Automator Alarm

Search for Find Finder Items and drag it into the workflow. In the Search drop down, select your Documents folder. Leave it as All of the Following are True. Then in the criteria drop-down select Date Last Opened, Is not in the Last, enter 30, and select Days. Then search for Move Finder Items, and drag that into the workflow. Finally, click the destination drop-down and select Other, and navigate to your network drive folder in the navigation pop-up.

Run the workflow to do the initial clean up. Save and name the file, then edit the calendar event and set it for a time when you can confirm your network drive will be available, and you don’t mind possibly uploading a lot of data.

Other Ideas

The basics of storage in Sierra are fairly nice. The directed clean up is something that has been in Windows for quite some time; and it’s not often us Mac users have to play catch up. Sierra’s iCloud storage optimization might need a bit more polish before road warriors can count on that presentation being there when they get on a plane to hammer out the final details. If your Mac is always online, you might not have this issue.

Related:  Mac & iOS Users: Why Aren’t You Using Safari Yet?

If you enjoyed hacking out scripts or creating your own workflow, you could use similar methods to create an automatic cleanup of your Downloads. Still dedicated to Applescript? Then show us in the comments how to create this workflow using the classic Mac scripting language.

Is there something on the Mac you want to see using Automator and shell scripts? Let us know in the comments.

Subscribe to TheGN via Email
Enter your email address to subscribe to this Website and receive notifications of new posts by email.

There are no comments yet