-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Basics
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.
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.
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) -s
or
YES=1 sh <(curl https://tea.xyz)
You can specify the location of tea. By default, TEA_PREFIX is "/.tea". If you change it, remember that all examples with "/.tea" should be replaced with your prefix.
TEA_PREFIX=/opt/tea sh <(curl https://tea.xyz)
You can also download the installer.
curl -o install.sh https://tea.xyz
You can also download the tea binary. curl dist.tea.xyz will print the url to the latest version. Or you can download it from the releases page.
curl dist.tea.xyz
# tea/cli
We recommend our installer (`sh <(curl tea.xyz)`), however tea/cli is a
standalone binary. Download for your platform and run it anywhere you like.
macOS/apple https://dist.tea.xyz/tea.xyz/darwin/aarch64/v0.16.0.tar.gz
macOS/intel https://dist.tea.xyz/tea.xyz/darwin/x86-64/v0.16.0.tar.gz
linux/aarch64 https://dist.tea.xyz/tea.xyz/linux/aarch64/v0.16.0.tar.gz
linux/intel https://dist.tea.xyz/tea.xyz/linux/x86-64/v0.16.0.tar.gz
# Further Information
https://github.com/teaxyz/cli
To update tea, run the same installer or download the newer binary.
sh <(curl https://tea.xyz)
Package managers automate installing, upgrading, configuring, and removing software.
tea is not a package manager.
tea is unified packaging infrastructure.
To clarify, tea includes package manager functionality but it doesn't have install, update, configure, or uninstall commands because you use tea for more than just package management. If you want to be boring, you can use tea exclusively for package management, but we hope you use tea for much more. More about that later. Let's discuss how tea does package management.
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). Because of this, the main tea documentation is aimed at developers.
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.
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/+.
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 programming languages.
In its most basic form, tea will install a package if needed and run a command or open a REPL with the package in the PATH.
tea +pkg
In the text above, "+pkg" should be replaced with the name of the package. Here is a real example that installs wget and opens a REPL. The REPL has tea in the PATH. which is a command that shows which command will run if you type it in the terminal. If which can't find a command, then the command isn't in the PATH.
> tea +gnu.org/wget
tea: installed: ~/.tea/gnu.org/wget/v1.21.3
this is a temporary shell containing the following packages:
openssl.org@1.1.118, gnu.org/wget@1.21.3
when done type: `exit'
tea ~ which wget
~/.tea/gnu.org/wget/v1.21.3/bin/wget
tea ~ wget
wget: missing URL
Usage: wget [OPTION]... [URL]...
Try `wget --help' for more options.
If you don't want to run a REPL, specify a command (and optional args). Here is the basic form.
tea +pkg command [args]
And this is how we'd execute wget.
tea +gnu.org/wget 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.org python
tea: installed: /opt/tea/python.org/v3.11.0
Hello, World
> 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/bin/env python
print("Hello, World")
Run it like this.
> tea +python.org hello-world.py
Hello, World
If a file ends in ".py", tea will automatically add +python.org, so you don't need to. I gave the examples above because it helps to understand what is going on behind the scenes. Run it like this.
> tea hello-world.py
Hello, World
Note, tea doesn't add anything it installs to the PATH. As shown above, you can execute the command directly or use tea to run stuff. The easiest way to get the stuff you install with tea added to the path (starting with the cli v0.14.5) is to create a symlink to tea using the name of the tool you'd like.
sudo ln -s tea /usr/local/bin/wget
That will create a symlink for wget. And it just works!
You can also create these symlinks in a different directory and add that directory to the PATH.
mkdir ~/.tea_bin
ln -s /usr/local/bin/tea ~/.tea_bin/tea
ln -s tea ~/.tea_bin/wget
export PATH="$HOME/.tea_bin:$PATH"
which wget
/Users/james/.tea_bin/wget
To permanently add that path to your shell (zsh) run this.
echo 'export PATH="$HOME/.tea_bin:$PATH"' >> ~/.zshrc
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 "$@"
Right now there is no difference between running something with tea and installing something and running it. So if you only want to install something, then run a command that doesn't do anything.
For example, install Python if missing and run python and print it's version.
tea +python.org python --version
Or just run the echo command and print nothing.
tea +python.org echo ""
Eventually, someone is going to write an extension that will only do installs. For now, because tea is designed to do more than just install packages it doesn't include the install command. Installing is just a by-product of using tea.
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.
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.
Some utilities will try to update themselves, but you shouldn't do that. Use tea to install the newer version. You don't want to do this.
tea +python.org=3.10.8 pip install --upgrade pip
It kind of defeats the purpose of having versioned installs.
tea's packages are installed as siloed virtual environments. You probably don't 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.
- 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)