Help language development. Donate to The Perl Foundation
Mac::Applications::List - get a list of applications on your macOS machine
use Mac::Applications::List; my @apps = apps; my @apps = apps '/some/path'; my @apps = apps < /path/to/dir1 /path/to/dir2 >; say @apps;
use Mac::Applications::List; my $my_apps = MacAppList.new(); # create a MacAppList object $my_apps.find_apps('/some/dir'); # populate object $my_apps.exists('Safari'); # test to see if an app exists $my_apps.print; # print out a list of apps $my_apps.list; # return an array of apps
This module finds and generates a list of applications found in the standard locations on macOS.
In the simplest usage, an automatically exported function,
a List of the apps found.
An OO interface is also provided which provides convenient methods for determining if an app exists, printing the list of apps, and returning the list of apps found.
Be default, the module searches
~/Applications directories. Additional directories can be searched by passing string
arguments, representing the paths of directories to be searched.
Returns a unique List of application names found in standard application installation directories on macOS. A string or array of strings of paths to other directories can be included to search additional directories.
:full-path options to have paths to the apps included. Otherwise,
the List contains only the names of the apps.
If the directory does not exist, the module generates a warning. The function will still return a list of applications found in other directories.
Creates a new MacAppList object, optionally initialized with directories to search which will be searched in addition to standard app directory locations.
Initialization also initiates a search for new apps in standard locations, plus any directories the object was initialized with plus any optional directories provided.
Returns an List of all apps names found.
Returns a List of all paths to the apps found.
Determines if an app exists. Returns a boolean value.
Prints out a comma-separated, alphabetical listing of apps to the command line
Assuming Raku and zef is already installed, install the module with:
zef install Mac::Applications::List
If you don't have Raku with zef installed yet, it's easiest to install them both with homebrew if you already have brew installed:
brew install rakudo-star
If you don't have brew installed, install it with:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Note, however, that the homebrew install may be months out of date.
To ensure you get the absolute latest version of Raku, see this
page for other
installation options. Whatever method you choose to install Raku, just be sure
zef command gets installed and is working on your machine as well.
This app will not find apps that have been "localized," i.e. apps contained in a directory with a ".localized" extension. A future release will address this issue.
©2022 – Cosmic heat death under the Artistic License, v2.0