CX is being revived in skycoin-cx. Work on the language stopped in 2023 and started again in November 2026, in one new repository that merges the old ones. There is no release yet, and CX chains, which were meant to run CX programs on a blockchain, are still unfinished. The language pages here follow the current code. The state of CX explains what has been done, what works, and what does not.
CX Installation
Table of Contents
Releases
CX has no release yet. CX now lives in skycoin/skycoin-cx, which has no binary releases or tags. The old binary releases of skycoin/cx and the Homebrew formula belong to the old repository and are out of date. Build CX from source.
Building from Source
CX needs Go 1.27.3 or newer, Git and make. Check your Go version
with go version. If you don't have Go, follow the instructions at
go.dev/doc/install.
Linux
These steps were run on a clean copy of skycoin-cx at commit
df4c9879, on Linux with Go 1.27.3:
git clone https://github.com/skycoin/skycoin-cx
cd skycoin-cx
make build
This puts the cx binary in bin/. Add that directory to your PATH
if you want to run cx from anywhere.
If a go.work file in a parent directory gets in the way of the build,
run GOWORK=off make build.
make build includes the cipher, os and regexp packages. Leave any
of them out with TAGS=nocipher, TAGS=nocxos or TAGS=noregexp, and
TAGS=ptr64 switches the virtual machine to 64 bit pointers.
The GUI Build
make build-gui adds the gl, glfw, al and gltext packages, the
cxfx build. It needs cgo, a C compiler and the OpenGL, X11 and OpenAL
headers. The repository README lists them for Debian and Ubuntu:
sudo apt-get install libgl1-mesa-dev xorg-dev libopenal-dev
make build-gui
make build-gui also writes bin/cx, so it replaces a plain build. It
was run for this page on Arch Linux, where the headers come with the
gcc, mesa, libx11, libxcursor, libxrandr, libxinerama,
libxi, libxxf86vm and openal packages. The build finished, but
no GUI program was run for this page.
Windows and macOS
The repository CI runs make check on Linux, macOS and Windows, so CX
builds on all three. The steps on this page were not run on Windows or
macOS. The README has
the install notes, for example to use Git Bash or MSYS2 on Windows so
that make has a shell.
Updating CX
There are no releases to update to. To get the latest code, run this in your skycoin-cx directory:
git pull
make build
Running CX
Running CX Programs
To run a CX program, type cx and the name of the file, for example
./bin/cx hello.cx. The tests/examples directory of the repository
holds more programs. The ones in tests/examples/opengl need the GUI
build.
A running program can only open files inside its sandbox, which is the
working directory unless cx --sandbox <dir> names another. Paths must
be relative and may not leave the sandbox through .. or a symlink.
Running the Tests
make test builds a test runner and runs the stable CX program tests.
On the clean clone above it ran 231 tests, all successful, and skipped
28. make check runs those and the repository's other checks, as CI
does.
Other Options
cx --help lists every option. Some useful ones:
-astprints the program's syntax tree instead of running it-executorchooses the loop that runs the program.auto, the default, uses the new flat virtual machine when every function of the program can run on it, and the old loop otherwise-heap-initialand-heap-maxset the size of the heap-envprints CX environment information
The REPL
Running cx with no arguments starts the REPL
(read-eval-print loop).
At commit df4c9879 it is not usable: it prints its prompt, but any
input, even i32.print(5), ends it with a syntax error panic. Run
programs from files until that is fixed.
Hello World
Do you want to know how CX looks? This is how you print "Hello, World!" in a terminal:
package main
import "sys/string"
func main () {
string.PrintLine("Hello, World!")
}
Every CX program must have at least a main package and a main
function. As mentioned before, CX has a strict type system, where
functions can only be associated with a single type signature. As a
consequence, if we want to print a string, as in the example above, we
call string.PrintLine from the built-in package sys/string, which
has to be imported like any other package.
However, there are some exceptions, mainly to functions where it makes
sense to have a generalized type signature. For example, the len
function accepts arrays of any type as its argument, instead of having
[]i32.len() or [][]str.len(). Another example is sprintf, which
is used to construct a string using a format string and a series of
arguments of any type.