This project provides a FUSE-based driver to mount iCloud Drive as a filesystem on Linux. It allows users to interact with their iCloud Drive files and directories as if they were part of the local filesystem.
- Mount iCloud Drive as a FUSE filesystem.
- Read and write files directly to iCloud Drive.
- Cache file and directory metadata for improved performance.
- Support for basic filesystem operations such as reading, writing, renaming, and deleting files and directories.
- Python 3
fuse-python
librarypyicloud
librarypyyaml
libraryjsonpickle
library- FUSE2 (Filesystem in Userspace)
-
Install Dependencies:
- Install FUSE2 and Python dependencies:
sudo apt install fuse # or `fuse2` pip install -r requirements.txt
- Install FUSE2 and Python dependencies:
-
Set Up Configuration:
- Copy the example configuration file to
/etc/icloud/config.yaml
:sudo mkdir -p /etc/icloud sudo cp config.example.yaml /etc/icloud/config.yaml
- Edit the configuration file to include your iCloud credentials:
username: "your_apple_id@example.com" password: "your_apple_id_password" cache_dir: "/tmp/icloud"
- Copy the example configuration file to
-
Install the Driver:
- Run the
Makefile
to install the driver and systemd service:make install
- Run the
-
Start the Service:
- The installation process will prompt you to specify a mount point (recommended:
/home/<user>/iCloud
). The service will be enabled and started automatically:systemctl enable --now icloud
- The installation process will prompt you to specify a mount point (recommended:
-
Verify the Mount:
- Check if the iCloud Drive is mounted at the specified location:
ls ~/iCloud
- Check if the iCloud Drive is mounted at the specified location:
The driver uses the pyicloud
library to interact with iCloud Drive and the fuse-python
library to implement a FUSE-based filesystem. It provides a seamless interface for accessing iCloud Drive files and directories on Linux.
-
Driver (
driver.py
):- Implements the FUSE filesystem operations such as
getattr
,readdir
,read
,write
,mkdir
,unlink
, etc. - Uses
pyicloud
to interact with iCloud Drive and fetch file metadata and content. - Caches file and directory metadata to improve performance and reduce API calls.
- Implements the FUSE filesystem operations such as
-
Configuration (
config.example.yaml
):- Stores iCloud credentials and FUSE options.
- Allows customization of cache directory and mount options.
-
Systemd Service (
icloud.service
):- Manages the lifecycle of the FUSE filesystem.
- Automatically mounts iCloud Drive on system startup.
-
Makefile:
- Automates the installation and uninstallation process.
- Copies necessary files to appropriate locations and sets up the systemd service.
The driver caches file and directory metadata to reduce the number of API calls to iCloud. Cached data is stored in memory and expires after 5 minutes. This improves performance when accessing frequently used files and directories.
If your iCloud account requires 2FA, the driver will prompt you to enter the verification code during initialization. The code is validated using the pyicloud
library.
- File Operations: Read, write, truncate, delete, rename.
- Directory Operations: Create, delete, list contents.
- Metadata Operations: Get file attributes, set file times (mocked).
To uninstall the driver and remove all related files:
-
Stop and disable the systemd service:
sudo systemctl stop icloud sudo systemctl disable icloud
-
Run the
Makefile
uninstall target:make uninstall
-
Verify that all files have been removed:
/usr/local/bin/icloud
/etc/icloud/
/etc/systemd/system/icloud.service
/tmp/icloud/
-
Debug Logging:
- Enable debug logging by running the driver with the
-f
(foreground),-v
(verbose), and-d
(FUSE debug) options:./driver.py -fvd ~/iCloud
- Enable debug logging by running the driver with the
-
Log File:
- Check the log file at
/var/log/icloud.log
for detailed error messages.
- Check the log file at
-
Permissions:
- Ensure that the mount point directory has the correct permissions for the user running the service.
This project is licensed under the MIT License. See the LICENSE file for details.