To get started using the tools in this repository first install them using one of the methods below.
git clone https://github.com/Soliez/mac-utils.gitFirst, cd into the project directory.
cd mac-utilsThen, run the following make command.
make installmake install PROFILE=~/.profilemake install PROFILE=<path-to-shell-profile>If you use a shell other than
bashorzsh, replace<path-to-shell-profile>with the path to your shell profile file in the above command
Please ensure you have installed a package manager such as homebrew as well as Apple's Command Line Tools for Xcode package. You can install them with the following command.
xcode-select --installPlease ensure you have them installed in order to use all the tools in this repository.
Clone this repo with git and cd into it
git clone https://github.com/Soliez/mac-utils.git && cd mac-utilsSome of the scripts in this repository require you to install an external dependency to use.
These dependencies include:
exiftool- Perl lib for reading and writing EXIF metadatajq- Lightweight and flexible command-line JSON processorman2html- Convert nroff man pages to HTMLpandoc- Swiss-army knife of markup format conversionffmpeg- Media Convertertree- Display directories as trees (with optional color/HTML output)
You can install each of these via Homebrew with the following one-liner.
brew install exiftool jq man2html pandoc ffmpeg treeA few of the tools in this repository are written in python.
Most of the functionality offered by these scripts is implemented using standard library modules.
Currently, there is a total of (1) external dependencies that tools in this repo rely on.
pyobjc- The Python <-> Objective-C Bridge with bindings for macOS frameworks
You can install each of these using pip, but first you'll have to create a new virtual environment (venv) in your local version of this repo's project directory
Run the following python command. This will create a new venv directory.
python3 -m venv venvInstall the python dependencies with the following pip command.
venv/bin/pip install --upgrade pip && venv/bin/pip install -r requirements.txt💡 These two examples assume you haven't changed directories since Step 2
You will need to update the shebang line in the scripts that need to use the venv you created.
This is necessary in order to run these scripts without having to manually activate the virtual environment with source venv/bin/activate every time you open a new terminal tab.
You can perform the shebang update to the scripts (currently it's just one) using the following commands.
shebang_queue="uti"
for file in $shebang_queue; do \
path="$PWD/bin/$file"
sed -i '' "1s|.*|#!$path|" "$path"
chmod +x $path
done💡 This example assumes you haven't changed directories since Step 2
shortcut-util is a feature rich command-line utility for Shortcuts power-users and scripting enthusiasts.
There are some subcommands this tool implements that have to interface with with the Shortcuts app internally (though not in a way that impacts the scriptability or that requires using a GUI)
For example, shortcut-util currently uses an Internal Utility Shortcut to fetch your Shortcuts for processing within the script before any signing occurs
Install the required utility shortcuts manually, or all at once with the following command.
You will have to manually tap 'Add Shortcut' for each item when the dialog appears
for workflow in $PWD/shortcuts/*; do
open -a Shortcuts "$workflow"; \
done💡 This example assumes you haven't changed directories since Step 2
You will need to add the project's bin directory to your PATH variable to be able to call each script without providing it's full path each time.
To enable this, add the following lines to your shell profile file (i.e ~/.profile or ~/.zprofile)
# Add mac-utils repository tools to PATH
export PATH="/path/to/mac-utils/bin:$PATH"In this example, replace
/path/to/mac-utils/binwith the full to path to thebindirectory in the mac-utils repository on your computer.
To get help on any of the scripts in this repository you can view it's manual page using man <SCRIPT-NAME> or by calling the script with its -h or --help flag.
To enable this, first run the following commands
# Create a local man directory in your home directory if it dosen't already exist
mkdir -p ~/man/man1
# Copy all of the project's manual pages to your local man directory
cp /path/to/mac-utils/man/*.1 ~/man/man1In this example, replace
/path/to/mac-utils/manwith the full to path to themandirectory in the mac-utils repository on your computer.
Next, add the following lines to your shell profile file (i.e ~/.profile or ~/.zprofile)
# Add mac-utils repo man pages to MANPATH
export MANPATH="$HOME/man/man1:$MANPATH"