CLI Reference
Description
One-way sync engine for the iCloud Photos Library into the native file system with archiving capabilities.
Synopsis
icloud-photos-sync [options] [command]
Use icloud-photos-sync [command] for information on a specific command. The following commands are available:
Options
data-dir
OPTIONAL | string
Directory to store local copy of library.
- Long Option:
--data-dir - Short Option:
-d - Environment Variable:
DATA_DIR - Default:
/opt/icloud-photos-library
download-threads
OPTIONAL | number
Sets the number of concurrent download threads (Infinity will remove all limitations).
- Long Option:
--download-threads - Short Option:
-t - Environment Variable:
DOWNLOAD_THREADS - Default:
5
download-timeout
OPTIONAL | number
Sets the timeout (in minutes) for downloading assets, because downloads sometimes hang. Should be increased on slower connections and/or if there are large assets in the library (Infinity will remove the timeout).
- Long Option:
--download-timeout - Environment Variable:
DOWNLOAD_TIMEOUT - Default:
10
enable-crash-reporting
OPTIONAL | boolean
Enables automatic collection of errors and crashes, see https://icps.steiler.dev/error-reporting/ for more information.
- Long Option:
--enable-crash-reporting - Environment Variable:
ENABLE_CRASH_REPORTING(empty environment variable forfalse) - Default:
false
enable-network-capture
OPTIONAL | boolean
Enables network capture, and generate a HAR file for debugging purposes. Written to .icloud-photos-sync.har in the data dir.
- Long Option:
--enable-network-capture - Environment Variable:
ENABLE_NETWORK_CAPTURE(empty environment variable forfalse) - Default:
false
export-metrics
OPTIONAL | boolean
Enables the export of sync metrics to a file using the Influx Line Protocol. Written to .icloud-photos-sync.metrics in the data dir.
- Long Option:
--export-metrics - Environment Variable:
EXPORT_METRICS(empty environment variable forfalse) - Default:
false
force
OPTIONAL | boolean
Forcefully remove an existing library lock. USE WITH CAUTION!
- Long Option:
--force - Environment Variable:
FORCE(empty environment variable forfalse) - Default:
false
health-check-url
OPTIONAL | url
URL to ping to monitor the health of icloud photos sync, see https://icps.steiler.dev/health-checks/ for more information.
- Long Option:
--health-check-url - Environment Variable:
HEALTH_CHECK_URL
legacy-login
OPTIONAL | boolean
Enables plain text legacy login method.
- Long Option:
--legacy-login - Environment Variable:
LEGACY_LOGIN(empty environment variable forfalse) - Default:
false
log-level
OPTIONAL | level
Set the log level.
- Long Option:
--log-level - Short Option:
-l - Environment Variable:
LOG_LEVEL - Default:
info - Choices:
debug,info,warn,error
log-to-cli
OPTIONAL | boolean
Disables logging to file and logs everything to the console.
- Long Option:
--log-to-cli - Environment Variable:
LOG_TO_CLI(empty environment variable forfalse) - Default:
false
max-retries
OPTIONAL | number
Sets the number of maximum retries upon a sync error (Infinity means that it will always retry).
- Long Option:
--max-retries - Short Option:
-r - Environment Variable:
MAX_RETRIES - Default:
10
metadata-rate
OPTIONAL | interval
Limits the rate of metadata fetching in order to avoid getting throttled by the API. Expects the format <numberOfRequests|Infinity>/<timeInMs>, e.g. 1/20 to limit requests to one request in 20ms.
- Long Option:
--metadata-rate - Environment Variable:
METADATA_RATE - Default:
Infinity/0
mfa-timeout
OPTIONAL | number
If a MFA code is necessary to authenticate, wait for these many seconds before canceling the authentication process. Time in seconds, should not exceed 10mins (due to server side timing).
- Long Option:
--mfa-timeout - Environment Variable:
MFA_TIMEOUT - Default:
600
password
OPTIONAL | string
AppleID password. Omitting the option will result in the CLI to ask for user input before startup.
- Long Option:
--password - Short Option:
-p - Environment Variable:
APPLE_ID_PWD
port
OPTIONAL | number
Port to serve the web ui on and to receive MFA input on.
- Long Option:
--port - Short Option:
-P - Environment Variable:
PORT - Default:
80
refresh-token
OPTIONAL | boolean
Invalidate any stored trust token upon startup.
- Long Option:
--refresh-token - Environment Variable:
REFRESH_TOKEN(empty environment variable forfalse) - Default:
false
region
OPTIONAL | string
Changes the iCloud region.
- Long Option:
--region - Environment Variable:
REGION - Default:
world - Choices:
world,china
remote-delete
OPTIONAL | boolean
If this flag is set, delete non-favorite photos in the iCloud Photos backend upon archiving.
- Long Option:
--remote-delete - Environment Variable:
REMOTE_DELETE(empty environment variable forfalse) - Default:
false
schedule
OPTIONAL | cron-string
In case this app is executed in daemon mode, it will use this cron schedule to perform regular sync operations.
- Long Option:
--schedule - Short Option:
-S - Environment Variable:
SCHEDULE - Default:
0 2 * * *
silent
OPTIONAL | boolean
Disables all output to the console.
- Long Option:
--silent - Short Option:
-s - Environment Variable:
SILENT(empty environment variable forfalse) - Default:
false
suppress-warnings
OPTIONAL | boolean
Non critical warnings will not be displayed in the UI. They will still go into the log.
- Long Option:
--suppress-warnings - Environment Variable:
SUPPRESS_WARNINGS(empty environment variable forfalse) - Default:
false
trust-token
OPTIONAL | string
The trust token for authentication. If not provided, the trust token is read from the .icloud-photos-sync resource file in data dir. If no stored trust token could be loaded, a new trust token will be acquired (requiring the input of an MFA code).
- Long Option:
--trust-token - Short Option:
-T - Environment Variable:
TRUST_TOKEN
username
OPTIONAL | string
AppleID username. Omitting the option will result in the CLI to ask for user input before startup.
- Long Option:
--username - Short Option:
-u - Environment Variable:
APPLE_ID_USER
version
OPTIONAL | boolean
output the version number
- Long Option:
--version - Short Option:
-V
web-base-path
OPTIONAL | string
The base path for subpath deployments, e.g. '/somePath' if the application is hosted under 'http://localhost/somepath/'.
- Long Option:
--web-base-path - Environment Variable:
WEB_BASE_PATH - Default: ``
Commands
archive
Archives a given folder. Before archiving, it will first perform a sync, to make sure the correct state is archived.
Usage:
icloud-photos-sync [options] archive [arguments]
Arguments:
path(REQUIRED): Path to the folder that should be archived
daemon
Starts the synchronization in scheduled daemon mode - continuously running based on the provided cron schedule.
Usage:
icloud-photos-sync [options] daemon
sync
Fetches the remote state and persist it to the local disk once.
Usage:
icloud-photos-sync [options] sync
token
Validates the current trust token, fetches a new one (if necessary) and prints it to the CLI.
Usage:
icloud-photos-sync [options] token