Cartesi MacPorts Ports Repository
To install the Cartesi Machine via MacPorts using our pre-built binary packages, add the following configuration to your MacPorts installation.
Append to /opt/local/etc/macports/sources.conf:
https://cartesi.github.io/macports-ports/ports.tar
Append to /opt/local/etc/macports/archive_sites.conf:
name Cartesi
urls https://cartesi.github.io/macports-ports
Save the following provisional public keys to files and add their absolute paths to /opt/local/etc/macports/pubkeys.conf.
These keys will be replaced when Cartesi issues permanent signing keys.
Signify public key (save as e.g. cartesi-macports-signify.pub):
untrusted comment: Cartesi MacPorts public key
RWTCC6+ZA8rZ7iZRbWKVowA9sBrpbJAoxXuTZIAHRDZFQyvaf0i1Ovso
RSA public key (save as e.g. cartesi-macports-rmd160-pubkey.pem):
-----BEGIN PUBLIC KEY-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAnl8Iz5P5r0nFCxCG+yxZ
0DS9sFTG5Y1tNZ93mnvPg6CV/XJvOSelX6TlxycZQ/MF7qJ0Qg+tT4g8yXRzQJla
rug9vPstmrv6gDWWQsB8JKrv1WVwmLYB2PsPJntZrvmNGMuainRQG8hUmXn4x6xF
yHilFJE7euDkIu4bLcj5692z8VzeCHiL69YzNoLehdoW48Au6XKaJM5kNVGXZr7o
UO+B8MjYNwgTloF185tMclRXBbxFAq3kCUlgG+qvYTeP9Z4Ii5RRN3ULesy19wq5
/EMTLPMoSiqCRwIZgzTkckuQFXDiD3Jz1W+j60Vy+2LgEPcetxRqo88DW0T3jE42
9QIDAQAB
-----END PUBLIC KEY-----
Then add both to pubkeys.conf:
/path/to/cartesi-macports-signify.pub
/path/to/cartesi-macports-rmd160-pubkey.pem
Then sync and install:
sudo port sync
sudo port install cartesi-machineThe following assumes
- You replace
<MACPORTS_PORTS>with the full path of your clonedcartesi/macports-portsrepository; - You replace
/opt/localwith the appropriate MacPorts prefix; - You replace
127.0.0.1:6227with the host name and port of the server used to distribute Portfiles and binary archives.
To generate a ports.tar with all portfiles, go to the base of the repo and run
cd <MACPORTS_PORTS>
tar -cvf ports.tar portsThis can be served from anywhere.
To test the setup, I used lighttpd with a configuration file <MACPORTS_PORTS>/lighttpd.conf:
server.document-root = "<MACPORTS_PORTS>"
server.username = "_www"
server.groupname = "_www"
server.port = 6227
dir-listing.activate = "enable"
mimetype.assign = (
".tbz2" => "application/x-bzip-compressed-tar",
".rmd160" => "text/binary",
# make the default mime type application/octet-stream.
"" => "application/octet-stream",
)
Don't forget to run the server
sudo port install lighttpd
/opt/local/sbin/lighttpd -D -f <MACPORTS_PORTS>/lighttpd.confMacPorts 2.12+ requires a signify signature for the ports tree tarball.
First, create a signify key pair (the -n flag skips the passphrase):
/opt/local/libexec/macports/bin/signify -G -n -c "Cartesi MacPorts" \
-p <MACPORTS_PORTS>/cartesi-macports-signify.pub \
-s <MACPORTS_PORTS>/cartesi-macports-signify.secThen sign the tarball:
/opt/local/libexec/macports/bin/signify -S \
-s <MACPORTS_PORTS>/cartesi-macports-signify.sec \
-m <MACPORTS_PORTS>/ports.tar \
-x <MACPORTS_PORTS>/ports.tar.sigNow append a new source to /opt/local/etc/macports/sources.conf.
# Cartesi test ports
http://127.0.0.1:6227/ports.tarNaturally, for the tests with lighttpd, I used IP=127.0.0.1 and PORT=6227.
To test this setup, you must first sync go anywhere and run
sudo port syncThis should produce something like
Synchronizing local ports tree from http://127.0.0.1:6227/ports.tar
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 33792 100 33792 0 0 45.2M 0 --:--:-- --:--:-- --:--:-- 32.2M
x emulators/
x emulators/cartesi-machine-linux-image/
x emulators/cartesi-machine-emulator/
x emulators/cartesi-machine-rootfs-image/
x emulators/cartesi-machine/
x emulators/cartesi-machine/Portfile
x emulators/cartesi-machine-rootfs-image/Portfile
x emulators/cartesi-machine-emulator/Portfile
x emulators/cartesi-machine-linux-image/Portfile
Creating port index in /opt/local/var/macports/sources/IP/PORT/ports
Adding port emulators/cartesi-machine-emulator
Adding port emulators/cartesi-machine-linux-image
Adding port emulators/cartesi-machine
Adding port emulators/cartesi-machine-rootfs-image
Total number of ports parsed: 4
Ports successfully parsed: 4
Ports failed: 0
Up-to-date ports skipped: 0
Now, first make sure there is no garbage left behind from some previous experiment
for p in cartesi-machine cartesi-machine-emulator cartesi-machine cartesi-machine-linux-image cartesi-machine cartesi-machine-rootfs-image; do
sudo port uninstall $p
sudo port clean --all $p
doneYou should now be able to install the ports from source by running
sudo port install -s cartesi-machine
This should output something like:
---> Computing dependencies for cartesi-machine
The following dependencies will be installed:
cartesi-machine-emulator
cartesi-machine-linux-image
cartesi-machine-rootfs-image
Continue? [Y/n]: Y
---> Fetching distfiles for cartesi-machine-emulator
---> Attempting to fetch add-generated-files.diff from https://distfiles.macports.org/cartesi-machine-emulator
---> Attempting to fetch add-generated-files.diff from https://lis.pt.distfiles.macports.org/cartesi-machine-emulator
---> Attempting to fetch add-generated-files.diff from https://fra.de.distfiles.macports.org/cartesi-machine-emulator
---> Attempting to fetch add-generated-files.diff from https://github.com/cartesi/machine-emulator/releases/download/v0.19.0-test2/
---> Attempting to fetch machine-emulator-0.19.0-test2.tar.gz from https://distfiles.macports.org/cartesi-machine-emulator
---> Attempting to fetch machine-emulator-0.19.0-test2.tar.gz from https://lis.pt.distfiles.macports.org/cartesi-machine-emulator
---> Attempting to fetch machine-emulator-0.19.0-test2.tar.gz from https://fra.de.distfiles.macports.org/cartesi-machine-emulator
---> Attempting to fetch machine-emulator-0.19.0-test2.tar.gz from https://github.com/cartesi/machine-emulator/archive/v0.19.0-test2
---> Verifying checksums for cartesi-machine-emulator
---> Extracting cartesi-machine-emulator
---> Applying patches to cartesi-machine-emulator
---> Configuring cartesi-machine-emulator
---> Building cartesi-machine-emulator
---> Staging cartesi-machine-emulator into destroot
---> Installing cartesi-machine-emulator @0.19.0-test2_0
---> Activating cartesi-machine-emulator @0.19.0-test2_0
---> Cleaning cartesi-machine-emulator
---> Fetching distfiles for cartesi-machine-rootfs-image
---> Attempting to fetch rootfs-ubuntu.ext2 from https://distfiles.macports.org/cartesi-machine-rootfs-image
---> Attempting to fetch rootfs-ubuntu.ext2 from https://lis.pt.distfiles.macports.org/cartesi-machine-rootfs-image
---> Attempting to fetch rootfs-ubuntu.ext2 from https://fra.de.distfiles.macports.org/cartesi-machine-rootfs-image
---> Attempting to fetch rootfs-ubuntu.ext2 from https://github.com/cartesi/machine-rootfs-image/releases/download/v0.20.0-test1/
---> Verifying checksums for cartesi-machine-rootfs-image
---> Extracting cartesi-machine-rootfs-image
---> Configuring cartesi-machine-rootfs-image
---> Building cartesi-machine-rootfs-image
---> Staging cartesi-machine-rootfs-image into destroot
---> Installing cartesi-machine-rootfs-image @0.20.0-test1_0
---> Activating cartesi-machine-rootfs-image @0.20.0-test1_0
---> Cleaning cartesi-machine-rootfs-image
---> Fetching distfiles for cartesi-machine-linux-image
---> Attempting to fetch linux-6.5.13-ctsi-1-v0.20.0.bin from https://distfiles.macports.org/cartesi-machine-linux-image
---> Attempting to fetch linux-6.5.13-ctsi-1-v0.20.0.bin from https://lis.pt.distfiles.macports.org/cartesi-machine-linux-image
---> Attempting to fetch linux-6.5.13-ctsi-1-v0.20.0.bin from https://fra.de.distfiles.macports.org/cartesi-machine-linux-image
---> Attempting to fetch linux-6.5.13-ctsi-1-v0.20.0.bin from https://github.com/cartesi/machine-linux-image/releases/download/v0.20.0/
---> Verifying checksums for cartesi-machine-linux-image
---> Extracting cartesi-machine-linux-image
---> Configuring cartesi-machine-linux-image
---> Building cartesi-machine-linux-image
---> Staging cartesi-machine-linux-image into destroot
---> Installing cartesi-machine-linux-image @0.20.0_0
---> Activating cartesi-machine-linux-image @0.20.0_0
---> Cleaning cartesi-machine-linux-image
---> Fetching distfiles for cartesi-machine
---> Verifying checksums for cartesi-machine
---> Extracting cartesi-machine
---> Configuring cartesi-machine
---> Building cartesi-machine
---> Staging cartesi-machine into destroot
---> Installing cartesi-machine @0.20.0_0
---> Activating cartesi-machine @0.20.0_0
---> Cleaning cartesi-machine
---> Scanning binaries for linking errors
---> No broken files found.
---> No broken ports found.
You should be able to run a simple test
which cartesi-machine && cartesi-machine
Producing
/opt/local/bin/cartesi-machine
.
/ \
/ \
\---/---\ /----\
\ X \
\----/ \---/---\
\ / CARTESI
\ / MACHINE
'
Nothing to do.
Halted
Cycles: 48600713
Binary archives must be signed.
MacPorts is in the process of transitioning from OpenSSL RIPEMD-160 signatures to signify.
As of MacPorts 2.12, the ports tree tarball uses signify (.sig), but binary archives still
require OpenSSL RIPEMD-160 (.rmd160). Until the transition is complete, we need both.
First, create an RSA key pair for signing binary archives.
openssl genrsa -out <MACPORTS_PORTS>/cartesi-macports-rmd160-privkey.pem 2048
openssl rsa -in <MACPORTS_PORTS>/cartesi-macports-rmd160-privkey.pem -pubout -out <MACPORTS_PORTS>/cartesi-macports-rmd160-pubkey.pemBy default, the command port archive now generates a directory with all the binaries inside it.
(This is later clonefile()ed to its final destination on install.)
I was unable to force it to generate binary archives unless I append a new option /opt/local/etc/macports/macports.conf:
# Generate binary archives as well
portimage_mode directory_and_archiveNow, first make sure there is no garbage left behind from some previous experiment
for p in cartesi-machine cartesi-machine-emulator cartesi-machine cartesi-machine-linux-image cartesi-machine cartesi-machine-rootfs-image; do
sudo port uninstall $p
sudo port clean --all $p
doneOnce that is done, we can build the archive for each of our ports, copy it to the archives directory, and sign it.
Something like this:
cd <MACPORTS_PORTS>
# create archives
mkdir archives
for t in emulator linux-image rootfs-image; do
p="cartesi-machine-$t"
cd ports/emulators/$p
sudo port archive -s
cd ../../..
mkdir -p archives/$p
cp /opt/local/var/macports/software/$p/$p*.tbz2 archives/$p
# sign archive
for b in archives/$p/*; do
openssl dgst -ripemd160 -sign cartesi-macports-rmd160-privkey.pem -out $b.rmd160 $b
done
doneTo test the binary packages, we need to first append our public keys to /opt/local/etc/macports/pubkeys.conf:
# Cartesi signify key for ports tree
<MACPORTS_PORTS>/cartesi-macports-signify.pub
# Cartesi RSA key for binary archives
<MACPORTS_PORTS>/cartesi-macports-rmd160-pubkey.pemAnd then append the new archive site to /opt/local/etc/macports/archive_sites.conf:
# Cartesi test binary packages
name Cartesi test
urls http://127.0.0.1:6227/archivesYou should now be able to install the ports from binary archives by running
sudo port install cartesi-machine
This should produce something like
---> Computing dependencies for cartesi-machine
The following dependencies will be installed:
cartesi-machine-emulator
cartesi-machine-linux-image
cartesi-machine-rootfs-image
Continue? [Y/n]: Y
---> Fetching archive for cartesi-machine-emulator
---> Attempting to fetch cartesi-machine-emulator-0.19.0-test2_0.darwin_23.arm64.tbz2 from http://127.0.0.1:6227/archives/cartesi-machine-emulator
---> Attempting to fetch cartesi-machine-emulator-0.19.0-test2_0.darwin_23.arm64.tbz2.rmd160 from http://127.0.0.1:6227/archives/cartesi-machine-emulator
---> Installing cartesi-machine-emulator @0.19.0-test2_0
---> Activating cartesi-machine-emulator @0.19.0-test2_0
---> Cleaning cartesi-machine-emulator
---> Fetching archive for cartesi-machine-rootfs-image
---> Attempting to fetch cartesi-machine-rootfs-image-0.20.0-test1_0.any_any.noarch.tbz2 from http://127.0.0.1:6227/archives/cartesi-machine-rootfs-image
---> Attempting to fetch cartesi-machine-rootfs-image-0.20.0-test1_0.any_any.noarch.tbz2.rmd160 from http://127.0.0.1:6227/archives/cartesi-machine-rootfs-image
---> Installing cartesi-machine-rootfs-image @0.20.0-test1_0
---> Activating cartesi-machine-rootfs-image @0.20.0-test1_0
---> Cleaning cartesi-machine-rootfs-image
---> Fetching archive for cartesi-machine-linux-image
---> Attempting to fetch cartesi-machine-linux-image-0.20.0_0.any_any.noarch.tbz2 from http://127.0.0.1:6227/archives/cartesi-machine-linux-image
---> Attempting to fetch cartesi-machine-linux-image-0.20.0_0.any_any.noarch.tbz2.rmd160 from http://127.0.0.1:6227/archives/cartesi-machine-linux-image
---> Installing cartesi-machine-linux-image @0.20.0_0
---> Activating cartesi-machine-linux-image @0.20.0_0
---> Cleaning cartesi-machine-linux-image
---> Fetching archive for cartesi-machine
---> Attempting to fetch cartesi-machine-0.20.0_0.any_any.noarch.tbz2 from http://127.0.0.1:6227/archives/cartesi-machine
---> Fetching distfiles for cartesi-machine
---> Verifying checksums for cartesi-machine
---> Extracting cartesi-machine
---> Configuring cartesi-machine
---> Building cartesi-machine
---> Staging cartesi-machine into destroot
---> Installing cartesi-machine @0.20.0_0
---> Activating cartesi-machine @0.20.0_0
---> Cleaning cartesi-machine
---> Scanning binaries for linking errors
---> No broken files found.
---> No broken ports found.