Install
openclaw skills install megacmd-developerBuild, debug, and contribute to the MEGAcmd project (C++/CMake/vcpkg). Use when the user needs to compile, set up a development environment, run tests, create packages, or understand MEGAcmd's internal architecture. Do NOT use for user operations (upload, sync, backup) — that is a different skill.
openclaw skills install megacmd-developerInstructions for BUILDING, DEBUGGING, TESTING, and CONTRIBUTING to the MEGAcmd repository. This skill is for developers who need to compile the project, set up the environment, or investigate the C++ source code.
⚠️ Do not activate this skill if the user just wants to USE MEGAcmd (upload, sync, backup). That is what the
megacmdskill is for.
megacmdMEGAcmd/
├── CMakeLists.txt # Main build system (488 lines)
├── vcpkg.json # vcpkg-managed dependencies
├── src/
│ ├── megacmd_server_main.cpp # Server entry point
│ ├── megacmd.cpp/h # MEGAcmd core
│ ├── megacmdexecuter.cpp/h # Command executor
│ ├── megacmdutils.cpp/h # Utilities
│ ├── megacmdcommonutils.cpp/h # Common utilities
│ ├── megacmdlogger.cpp/h # Logging system
│ ├── megacmd_fuse.cpp/h # FUSE support
│ ├── megacmdshell/ # Interactive shell
│ ├── client/ # Client (mega-exec + mega-* wrappers)
│ │ ├── megacmd_client_main.cpp
│ │ ├── megacmdclient.cpp/h
│ │ ├── mega-* # Bash wrappers (Linux/macOS)
│ │ └── win/mega-*.bat # Windows wrappers
│ ├── comunicationsmanager.cpp/h # IPC (File Sockets / Named Pipes)
│ ├── configurationmanager.cpp/h # Configuration
│ ├── listeners.cpp/h # SDK listeners
│ ├── sync_command.cpp/h # Sync command
│ ├── sync_ignore.cpp/h # Ignore patterns
│ └── sync_issues.cpp/h # Sync issues
├── tests/
│ ├── unit/ # Unit tests (C++)
│ ├── integration/ # Integration tests (C++)
│ └── *.sh, *.py # Shell/Python tests
├── build/
│ ├── cmake/modules/ # CMake modules
│ ├── installer/ # Installers (NSIS, DMG, scripts)
│ ├── megacmd/ # Debian packages
│ └── templates/megacmd/ # RPM spec, PKGBUILD, DSC
├── contrib/
│ ├── docs/ # Documentation (76 commands + guides)
│ ├── sanitizer/ # ASan, LSan, TSan suppressions
│ └── updater/ # Updater file lists
├── sdk/ # MEGA SDK (git submodule)
└── jenkinsfile/ # CI/CD (Jenkins)
# Git + submodules
git clone https://github.com/meganz/MEGAcmd.git
cd MEGAcmd && git submodule update --init --recursive
# Debug
cmake -B build/build-cmake-Debug -DCMAKE_BUILD_TYPE=Debug
cmake --build build/build-cmake-Debug -j$(nproc)
# Release
cmake -B build/build-cmake-Release -DCMAKE_BUILD_TYPE=Release
cmake --build build/build-cmake-Release -j$(nproc)
# With tests
cmake -B build/build-cmake-Debug -DCMAKE_BUILD_TYPE=Debug -DENABLE_MEGACMD_TESTS=ON
cmake --build build/build-cmake-Debug -j$(nproc)
sudo cmake --install build/build-cmake-Release
| Flag | Description |
|---|---|
-DVCPKG_ROOT=/path | Path to vcpkg (default: ../vcpkg) |
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache | Use ccache |
-DENABLE_MEGACMD_TESTS=ON | Build tests |
-DCMAKE_INSTALL_PREFIX=/path | Installation directory |
| Target | Type | Description |
|---|---|---|
mega-cmd-server | Executable | Server |
mega-cmd | Executable | Interactive shell |
mega-exec | Executable | Non-interactive client |
mega-cmd-updater | Executable | Updater |
mega-cmd-tests-unit | Executable | Unit tests |
mega-cmd-tests-integration | Executable | Integration tests |
LMegaCmdCommonUtils | Static library | Common utilities |
LMegacmdServer | Static library | Server logic |
LMegacmdClient | Static library | Client logic |
pcre, cryptopp, curl (with zstd), icu, libsodium, sqlite3
| Feature | Dependency | Activation |
|---|---|---|
use-openssl | openssl | CMake |
use-mediainfo | libmediainfo | CMake |
use-freeimage | freeimage + jasper | CMake |
use-ffmpeg | ffmpeg (avcodec, avformat, swresample, swscale) | CMake |
use-libuv | libuv | CMake (WebDAV/FTP) |
use-pdfium | pdfium | CMake |
use-readline | readline | CMake |
megacmd-enable-tests | gtest | -DENABLE_MEGACMD_TESTS=ON |
# Unit tests
./build/build-cmake-Debug/tests/mega-cmd-tests-unit
# Integration tests (requires server running)
./build/build-cmake-Debug/tests/mega-cmd-tests-integration
# Python tests
python3 tests/megacmd_put_test.py
python3 tests/megacmd_get_test.py
python3 tests/megacmd_find_test.py
# Standard build
docker build -f build-with-docker/Dockerfile.cmake .
# Synology cross-compile
docker build -f build/SynologyNAS/dockerfile/synology-cross-build.dockerfile .
# Start server with debug
MEGAcmdServer --debug # MEGAcmd=DEBUG, SDK=DEFAULT
MEGAcmdServer --debug-full # MEGAcmd=DEBUG, SDK=DEBUG
MEGAcmdServer --verbose-full # MEGAcmd=VERBOSE, SDK=VERBOSE
# Or via env var
MEGACMD_LOGLEVEL=FULLVERBOSE MEGAcmdServer
MEGACMD_JSON_LOGS=1 MEGAcmdServer # JSON HTTP request logging
$HOME/.megaCmd/megacmdserver.log%LOCALAPPDATA%\MEGAcmd\.megaCmd\megacmdserver.logConfigure via megacmd.cfg in the log directory:
RotatingLogger:RotationType=Timestamp # Timestamp | Numbered
RotatingLogger:CompressionType=Gzip # Gzip | None
RotatingLogger:MaxFileMB=50
RotatingLogger:MaxFilesToKeep=20
RotatingLogger:MaxFileAgeSeconds=2592000 # 30 days
RotatingLogger:MaxMessageBusMB=512
Files in contrib/sanitizer/:
asan.suppressions — AddressSanitizerlsan.suppressions — LeakSanitizertsan.suppressions — ThreadSanitizerJenkinsfiles in jenkinsfile/:
Jenkinsfile_MR_linux, Jenkinsfile_MR_macos, Jenkinsfile_MR_windowsJenkinsfile_MR_linux_packagesBranch_status/ — Release build pipelinesTemplate at .github/ISSUE_TEMPLATE/bug_report.yml
Files in build/megacmd/: control, rules, postinst, prerm, changelog
build/templates/megacmd/megacmd.spec
build/templates/megacmd/PKGBUILD
build/installer_win.nsi — Installer scriptbuild/installer/ — Icons, banners, resourcesbuild/installer_mac.sh — Installation scriptbuild/installer/Info.plist.in — Info.plist templatebuild/SynologyNAS/generate_pkg.sh — Generate SPK packagebuild/SynologyNAS/toolkit/source/MEGAcmd/ — Installation scripts./build/generate_deb_changelog_entry.sh
./build/generate_rpm_changelog_entry.sh
Files in src/updater/ and contrib/updater/:
MegaUpdater.cpp — Update logicfileswin.txt, fileswin64.txt, filesmacos.txt — File lists per platformUsed between mega-exec and mega-cmd-server. Implementation in comunicationsmanagerfilesockets.cpp.
Used on Windows. Implementation in comunicationsmanagernamedpipes.cpp and megacmdshellcommunicationsnamedpipes.cpp.
src/client/python/mega-execports — connects on port 12300:
127.0.0.1:12300127.0.0.1:12300 + socketOutIdOptions in build/cmake/modules/megacmd_options.cmake:
USE_PCRE — PCRE for regular expressions (default: ON)USE_MEDIAINFO — MediaInfo (default: ON)USE_FREEIMAGE — FreeImage (default: ON)USE_FFMPEG — FFMPEG (default: ON)USE_LIBUV — libuv for WebDAV/FTP (default: ON)USE_PDFIUM — PDFium (default: ON)USE_READLINE — Readline (default: ON)ENABLE_MEGACMD_TESTS — Build tests (default: OFF)File build/version contains the current version: 2.5.2
megacmdsdk/megacmdexecuter.cpp (executecommand method)getUsageStr() in megacmd.cpp and HelpFlags