Skip to content
Max Howell edited this page Mar 31, 2023 · 12 revisions

tea works in the terminal. The instructions on this page are aimed at people who aren't developers and are new to Terminal. So it's pretty basic. And there will be a lot of examples.

If you don't know how to use the terminal, please do a web search for "unix terminal" and read a little bit before trying anything here. You should at least understand how to read paths (e.g. "~/" vs "/"), what a symlink is, how the Terminal finds commands or tools to run (the PATH variable), and what wget is.

Installing tea

If you are on Windows, you first need to install Windows Subsystem for Linux (WSL).

In the macOS or Linux terminal (Windows users need to use the WSL terminal), just type this command in.

sh <(curl https://tea.xyz)

The installer will ask if you want to create a symlink in /usr/local/bin. If you don't select yes, then a lot of the examples won't work and you'll need to specify the path to tea each time you run it. The installer will also ask if it can modify ~/.zshrc. That change is mostly for developers, but it won't hurt to say yes. Besides those 2 changes, tea doesn't change anything outside of its directory.

tea will be installed to ~/.tea.

The tea installer is located at https://tea.xyz. When that webpage is loaded by curl, it returns the installer instead of the webpage.

Alternate Installations

Here are some of the options when you install tea. For example, you can install it silently (answering yes to all the questions).

sh <(curl https://tea.xyz) --yes

You can specify the location of tea. By default, tea is installed at "/.tea". If you change it, remember that all examples with "/.tea" should be replaced with your prefix.

sh <(curl https://tea.xyz) --prefix /opt/tea

Be sure to set the $TEA_PREFIX environment variable if you change the location (otherwise it won’t work).

export TEA_PREFIX=/opt/tea

You can also download the installer.

curl -o install.sh https://tea.xyz

You can also download the tea binary directly:

curl -o tea https://tea.xyz/$(uname)/$(uname -m)
    chmod u+x tea
    ./tea --help

Updating tea

To update tea, run the same installer.

sh <(curl https://tea.xyz)

Or you can have tea update itself:

    tea --sync +tea.xyz

To update tea’s pantry run tea --sync.

$ tea --sync
# ^^ inside a dev-env this also updates the packages in that env

What are Package Managers?

Package managers automate installing, upgrading, configuring, and removing software.

tea is the next-generation, cross-platform package manager.

tea doesn't have install, update, configure, or uninstall commands. If you install the one-line shell hook, then tea will automatically install what you type if there is a package for it. If you don't use the one-line shell hook, then just type tea followed by what you want to be installed.

There are basically 2 types of package managers: OS and source code package managers. An OS package manager installs tools that you can use in the terminal. A source code package manager installs libraries and source code files that a developer would use to create tools.

Existing OS package managers.

  • Homebrew (macOS and Linux)
  • apt (Linux)
  • Chocolatey (Windows)

Existing source code managers (these run on all platforms).

  • npm
  • pip
  • gem

tea aims to work with both os and source code. At first, the focus is on managing source code (because that same source code is going to be used to then build everything else later on down the road).

If you use one of the other package managers, tea isn't trying to replace the existing tools. tea's infrastructure is being designed so existing package managers will be able to use it. If you are involved in the other package managers, we really hope you are willing to consider our infrastructure.

Find tea Packages

There is a lot of room for improvement here. The packages are listed on tea's front page, tea.xyz, or the dedicated packages page, tea.xyz/+, or you can view all versions, https://tea.xyz/bottles/.

You can also look in ~/.tea/tea.xyz/var/pantry/projects. That won't list all of the software though.

As of early December 2022, here's a short quick list of some useful tools.

And here is a short quick list of some compilers and interpreters.

Install packages

In its most basic form, tea will install a package if needed and run the command.

> tea wget
installed: ~/.tea/curl.se/ca-certs/v2022.7.19
installed: ~/.tea/openssl.org/v1.1.1s
installed: ~/.tea/gnu.org/wget/v1.21.3
wget: missing URL
Usage: wget [OPTION]... [URL]...

Try `wget --help' for more options.

If you really want to install something without running it, specify the package namespace and run echo -n.

tea +pkg echo -n

Example.

> tea +gnu.org/wget echo -n
installed: /opt/tea/curl.se/ca-certs/v2022.7.19
installed: /opt/tea/openssl.org/v1.1.1s
installed: /opt/tea/gnu.org/wget/v1.21.3
> which wget
wget not found
> tea +gnu.org/wget which wget
/Users/max/.tea/gnu.org/wget/v1.21.3/bin/wget

tea Execution

This is how we'd execute wget.

tea wget http://example.com

You can also execute wget by specifying the path directly.

~/.tea/gnu.org/wget/v\*/bin/wget http://example.com

Here's a different example. This runs the Python "Hello, World" example. Installing and running Python has never been easier.

> echo 'print("Hello, World")' | tea python
Hello, World

Or

> tea +python.org python -c 'print("Hello, World")'
Hello, World

Here is a Python script. Use TextEdit, Notepad, or a Terminal editor to create this file. Save this code and name it "hello-world.py".

#!/usr/local/bin/tea python

print("Hello, World")

Run it like this.

> chmod 755 hello-world.py
> ./hello-world.py
Hello, World

tea PATH

Note, tea doesn't add anything it installs to the PATH. As shown above, use tea to run stuff or you can execute the command directly. If you really want to leave tea off, then you can create a symlink.

cd /usr/local/bin
ln -s ~/.tea/gnu.org/wget/v\*/bin/wget

You can also symlink directly to tea, it will execute the symlink name.

sudo ln -s tea /usr/local/bin/wget

You can also create shell aliases or wrapper scripts. Here is an alias. Put this in ~/.zshrc

alias foo='tea +foo/bar foo'

Here is a shell script. Put this in /usr/local/bin

#!/bin/sh
exec tea +foo/bar foo "$@"

Install a Specific Package Version

Specify a specific version of a package.

tea +python.org=3.10.8 python

Specify a minimum version. This will run the latest python 3.10.x.

tea +python.org^3.10.0 python

This will run the latest python 3.x.

tea +python.org^3.10 python

Do not modify the version symlinks in ~/.tea/, for example.

ls -l /opt/tea/lua.org:
total 0
lrwxr-xr-x  1 u0076374  wheel    6 Dec  3 01:26 v* -> v5.4.4
lrwxr-xr-x  1 u0076374  wheel    6 Dec  3 01:26 v5 -> v5.4.4
lrwxr-xr-x  1 u0076374  wheel    6 Dec  3 01:26 v5.4 -> v5.4.4
drwxr-xr-x  7 u0076374  wheel  224 Dec  1 11:03 v5.4.4

The symlinks in those directories are for you so you can access specific versions. Changing them won't alter what version tea runs. Use the tea +pkg=version format to control what tea uses.

Uninstalling Packages

Packages are self-contained. Just remove the directory for the package.

rm -r ~/.tea/**pkg_name**

If you create symlinks, aliases, or wrapper scripts (see discussion of the path), then remove those too.

Upgrading Packages

Some utilities will try to update themselves, but you shouldn't do that. For example, you don't want to do this. It defeats the purpose of having versioned installs.

tea +python.org=3.10.8 pip install --upgrade pip <-- DON'T DO THIS

Use tea --sync to install newer versions.

Installing "Globally" into a Package Silo

tea's packages are installed as siloed virtual environments. You may not want to install other packages into them.

tea +python.org pip install some_package

The package will be installed to ~/.tea/python.org/v3.11.0/lib/python3.11/site-packages.

tea -X npm install -g some_package

The package will be installed to ~/.tea/npmjs.com/v9.0.1/lib/node_modules. This probably isn't what you want.

Summary of steps

  • Install tea
  • Find a package that tea supports
    • The tea.xyz website lists all of the packages it supports.
    • You can also look in ~/.tea/tea.xyz/var/pantry/projects
  • Install and use the package
    • tea +pkg cmd [args]
    • Optional: symlink e.g ln -s tea /usr/local/bin/**cmd_name**
    • Optional: alias (see above)
    • Optional: wrapper shell script (see above)
Clone this wiki locally