With Montery, many MacAdmins have been seeing dialogs that state:
“ProcessName” needs to be updated
and often the “ProcessName” is your management system. As others have already pointed out, the process, or scripts this process is calling, is using the pre-installed Python 2.7 at
This is Apple’s next level of warning us that that the pre-installed Python (and Perl and Ruby) is deprecated and going away in “future version of macOS.” I have written about this before.
Even though the management system will be identified as the process that “needs to be updated,” the culprits are scripts and scriptlets that the management system calls for for management tasks (e.g. policies, tasks, scripts) and information gathering (e.g. extension attributes, facts, etc.). Ben Tom’s post above has information on how to identify scripts which may use python in a Jamf Pro server.
You can suppress the warning using a configuration profile. While this a useful measure to avoid confusing users with scary dialogs, you will have to start identifying and fixing scripts that are written entirely in python or just use simple python calls, and replacing them with non-python solutions.
Python 2.7 is not getting any more security patches and I assume Apple is eager to remove it from macOS. The clock is really ticking on this one.
The most common python call is probably the one which determines the currently logged in user. The python call for this was developed by Mike Lynn and popularized by Ben Toms in this post and has been a reliable MacAdmin tool for years. I have written about this and introduced a shell-based solution discovered by Erik Berglund.
But there are other use cases, where it is not so straight forward to replace the python code. The built-in python is so popular for MacAdmin tasks because it comes with PyObjC which allows access to the macOS system frameworks. With a few python calls you can avoid having to build an Objective-C or Swift command line tool.
I built desktoppr for this reason. The standard way to set a desktop picture with locking it down was a line of AppleScript. But, starting in macOS Mojave, sending AppleEvents to another process (in this case Finder) required a PPPC profile. You can also set the desktop picture using a framework call. There were python scripts out there, but the Swift solution will survive them…
Available Disk Space
Yesterday, I came across another such problem. With the recent versions of macOS, getting a value of the available disk space is not as strightforward as it used to be. There are a lot of files and data on the system, which will be cleared out when some process requires more disk space. Most of this is cache data or data that can be restored from cloud storage. But this ‘flexible’ available disk space will not be reported by the traditional tools, such as
diskutil. The available disk space these tools report will be woefully low.
The available disk space which Finder reports will usually be much higher. There is functionality in the macOS system frameworks where apps can get the values for available that takes the ‘flexible’ files into account. There is even useful sample code!
Starting with this sample code, I built a command line tool that reports the different levels of ‘available’ disk space. When you run
diskspace it will list them all. There are raw and ‘human-readable’ formats.
> diskspace -H
Available: 70.62 GB
Important: 231.8 GB
Opportunistic: 214.05 GB
Total: 494.38 GB
The ‘Available’ value matches the actually unused disk space that
diskutil will report. The ‘Important’ value matches what Finder will report as available. The ‘Opportunistic’ value is somewhat lower, and from Apple’s documentation on the developer page, that seems to be what we should use for automated background tasks.
For use in scripts, you can get each raw number with some extra flags:
> diskspace --available
> diskspace --important
> diskspace --opportunistic
> diskspace --total
You can get more detail by running
If you wanted to check if there is enough space to run the macOS Monterey upgrade (26 GB) you could do something like this:
if [[ $(/usr/local/bin/diskspace --opportunistic ) -gt 26000000000 ]]; then
echo "go ahead"
echo "not enough free disk space"
Jamf Extension Attributes
Or, you can use
diskspace in a Jamf Extension Attribute:
# test if diskspace is installed
if [ ! -x "$diskspace" ]; then
# return a negative value as error
echo "<result>$($diskspace --opportunistic)</result>"
Since, this extension attribute relies on the
diskspace tool being installed, you should have a ‘sanity check’ to see that the tool is there.