WP-CLI is the command-line interface for WordPress. It allows you to manage your WordPress site from the command line without using a web browser. I currently use WP-CLI to create and configure a version of this site to run in a local AMP environment on my Mac and – in conjunction with launchd – periodically change the posts that appear in the slider on this site’s home page.
Checking if a File Exists in iCloud from the Command Line
While moving selected local files and folders to iCloud I came across a folder on my Mac containing a large number of documents some of which appeared to be duplicates of those on iCloud. Before deciding which ones to move, I wanted to check each one to see if it already existed on iCloud.
Removing Entries from the Microsoft Office Apps Recent Files Lists in macOS
Every so often – usually around the time of a major new macOS release – I perform a clean install of the OS on my Macs. Along with restoring user data I tend to restore the configuration data of certain applications including the Microsoft Office applications. While this is a great timesaver, it can also cause some unexpected results. For example, the Recent file lists in Excel, PowerPoint and Word. Let’s use Word as an example.
Automator Action to Toggle the Display of Desktop Icons in macOS
It’s no secret that Desktop icons can be hidden in macOS, but unlike many user-configurable options neither System Preferences
nor the Finder
‘s preferences provide a way to toggle their display. It’s true that the Desktop display of drive icons and some device icons can be controlled through the Finder
, but in this context Desktop icons refer to all icons shown on the Desktop including those that represent folders, files or symbolic links.
Setting the Desktop Image in macOS Mojave From the Command Line
Prior to OS X Mavericks 10.9 a user’s Desktop image was stored in com.apple.desktop.plist
located in the ~/Library/Preferences/
folder and changed from the command line using:
defaults write com.apple.desktop Background '{default = {ImageFilePath = "/path/to/desktop/image.jpg";};}'
Setting the Date and Time Format for the macOS Menu Bar Clock Using Terminal
In the Clock
tab of the Date & Time
pane of System Preferences
you can choose between displaying a digital or analog clock in the menu bar. For a digital clock there are five options that determine how the date and time are displayed:
Add a Recent or Favorites Folder to Your Dock Using the macOS Terminal
Type the query add recents dock terminal into any Internet search engine and most – if not all – relevant entries on the first results page will give the following code or a slight variation of it:
defaults write com.apple.dock persistent-others -array-add '{"tile-data" = {"list-type" = 1;}; "tile-type" = "recents-tile";}'; killall Dock
Most of these articles are from 2015 or earlier and the Mac OS has changed a lot since, but the code still appears to do exactly as advertised.
Conditional Statement in Python One-liner on Command Line
I had a situation where I needed to pass code to Python in the form of a single command instead of a script file. While this is easily done by invoking Python in command mode, the code contained a conditional statement that caused Python to throw an error.
Secure Erasing a Mac Fusion Drive
Before selling my late 2015 27″ iMac Retina 5K I wanted to secure erase its 1TB Fusion Drive consisting of a 24GB SSD and 1TB HDD. Secure erasing an HDD is simple enough using the Security Options in Disk Utility
, but for Fusion Drives and SSDs this option is not available. To secure erase the iMac’s HDD I first needed to break the Fusion Drive into its constituent parts using Terminal
.
Changing the MySQL Root User Password in MAMP
Having recently changed my local testing server environment from XAMPP to MAMP v2.0.5 I wanted to change the password for the MySQL root user. By default it’s set to root.
Changing the MySQL password for the root user was straightforward enough, but locating and editing the files to reflect the new password was a different story. Failure to update all the necessary files results in MAMP reporting the following error:
/Applications/MAMP/Library/bin/mysqlcheck: Got error: 1045: Access denied for user 'root'@'localhost' (using password: YES) when trying to connect
Recent Comments