Modules and trees basic howto

Russell Allen mail at
Fri Jan 15 06:47:25 UTC 2016

Hi guys, 
This is more for my benefit, but here is roughly how I’m currently using modules and trees to maintain separate projects that aren’t in the main Self objects tree. This is just text, I should do this properly with pics and/or video, but here ’tis:

A very short guide to creating a Self project, for example developing the Self webserver.

First, clone the Self tree from the Github repo:

> git clone git at

Next, set the environment variable SELF_WORKING_DIR to the objects folder of the main Self tree (ie a clone of the Github repo). For example:

> export SELF_WORKING_DIR=/home/russell/self/objects

Then, create a git repo for your new project and cd to it:

> git init myproj
> cd myproj

(or create a new project on Github and clone it)

Then, build a new working snapshot from the main tree:

> Self -f /home/russell/self/objects/worldbuilder.self

If you want to use the Self development UI (which is recommended) then choose yes to the question "Load UI2 (Morphic)? (y/N)"

When you are at the Self prompt, start the GUI with:

"Self 0" desktop open

You now need to register the directory your Git repository is working with as a tree to place your code in. In a shell, do:

> modules init registerTree: 'mytree' At: '/full/path/to/myproj'.

Now, when you create a new object and mark it as belonging to a module, you can set the module as belonging to your tree.

> modules myModule tree: 'mytree'

At this point everything should work as expected, ie when you write out modules they should go to the appropriate directory.

If you choose to save your snapshot, you can save it to the existing working directory (ie .../myproj)

You can rebuild using the same steps, eg:

> export SELF_WORKING_DIR=/home/russell/self/objects
> cd /home/russell/myproj
> Self -f /home/russell/self/objects/worldbuilder.self
> "Self 0" modules init registerTree: 'mytree' At: '/home/russell/myproj'
> "Self 1" bootstrap read: 'myModule' InTree: 'mytree'

Cheers, Russell

More information about the Self-interest mailing list