Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to find MacOS 'Utilities' folder contents with Python

When calling :

 Path('/Applications/Utilities').iterdir()

The returned result is only ‘.localized’ but when I look in the Utilities folder with finder there are many apps – Disk Utility, Airport Utility, etc.

I hav also tried .listdir() with the OS module and same result.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Bigger code sample

def find_apps(directory_item: Path, nested_apps: list) -> None:

if item_is_app(directory_item):
    nested_apps.append(directory_item)
    return

if item_is_directory(directory_item):
    for item in directory_item.iterdir():
        find_apps(item, nested_apps)

return

I can’t seem to figure out how to view the apps in the Utilities directory – I don’t have a problem with other folders in the directory. e.g. My Python 3.11 folder correctly produces all apps such as Python Launcher.app and IDLE.app

>Solution :

Now the Applications from an OS installation are located in the /System/Applications/ folder. So in your case /System/Applications/Utilities/.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading