Skip to content

Usage for Command Line (CLI) on macOS Version

Yi Xie edited this page Dec 29, 2021 · 8 revisions

Introduction

macOS version of waifu2x supports command line interface. Due to certain limitations you have to perform additional steps to use it.

Usage

  1. Locate installation path (normally /Applications/waifu2x.app/)
  2. In command line, enter executable path:
cd /Applications/waifu2x.app/Contents/MacOS
  1. Print usages:
./waifu2x --help
  1. If you want to use CLI in other places, please specify full path to the executable (for example /Applications/waifu2x.app/Contents/MacOS/waifu2x --help). Alternatively, you can add /Applications/waifu2x.app/Contents/MacOS to PATH. Symlink won't work because of rpath issues.

Another choice is to put a launcher script under PATH, for example /usr/local/bin:

#!/bin/sh

#Edit this line to specify the path to waifu2x.app
WAIFU2X_APP="/Applications/waifu2x.app"

if [ ! -d "${WAIFU2X_APP}" ] ; then
	echo "waifu2x.app not found";exit 1;
fi

"${WAIFU2X_APP}/Contents/MacOS/waifu2x" "$@"

Grant Permissions

Due to App Sandbox which is required for App Store, by default the app does not have access to any files on the disk.

To grant both read and write access to a directory, please drop the desired directory like below:

If you cannot perform the drop, please restart the app and try again.

Alternatively, you can drop root directory / to grant access to everything:

After the permission is granted successfully, it will show a notice:

You can then use the command line normally.

Additional Notes

  1. Due to sandbox the working directory will not be respected. You have to use absolute path.
  2. Advanced settings (color depth, ANE, etc.) in the app are ignored. You must specify via command line flags.
Clone this wiki locally