百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
A

alcless

> 编程语言
开源

Alcoholless: 适用于 Homebrew、AI 代理等的 macOS 上的轻量级安全沙箱

193 stars0 点赞2 次浏览
访问官网GitHub

工具介绍

Alcoholless: 适用于 Homebrew、AI 代理等的 macOS 上的轻量级安全沙箱

[Homebrew] [✦Gemini] [֎Codex] [✴️Claude Code] [OpenCode]

Alcoholless: lightweight security sandbox for Homebrew, AI agents, etc.

Alcoholless is a lightweight security sandbox, primarily for macOS programs.

While Alcoholless was originally made for the sake of securing Homebrew, basically it can be used for almost any CLI programs. Notably, Alcoholless is useful for allowing an AI agent to run shell commands with less risk of breaking the host operating system.

See also my blog article:

Examples

Homebrew

Alcoholless Homebrew (alcless brew) executes Homebrew in a separate environment so as to reduce concerns around potential supply chain attacks.

bash
cd ~/SOME_DIRECTORY
alcless brew install xz
alcless xz SOME_FILE

In the example above, xz works as a separate user with an access for the copy of the current directory. The changed files are synced back to the current directory when the command exits, with a confirmation screen (see below). Other directories are inaccessible, as long as the permissions are set correctly.

Confirmation screen

…

[!IMPORTANT]

Alcoholless uses a Tier 3 configuration of Homebrew that uses a custom installation prefix. Some formulae may not work.

AI agents

Alcoholless is useful for sandboxing AI coding agents too. The file changes made by the AI are committed to the host filesystem only after the user confirmation.

Gemini

bash
cd ~/SOME_DIRECTORY
alcless brew install gemini-cli
alcless gemini

Codex

bash
cd ~/SOME_DIRECTORY
alcless brew install codex
alcless codex

Claude Code

bash
cd ~/SOME_DIRECTORY
alcless brew install claude-code
alcless claude

Troubleshooting

Claude Code may need extra steps for the initial setup (issue #52):

  • Switch the desktop user to alcless_USER_default via the Fast User Switching icon in the macOS menubar.
  • Run the following commands in the alcless_USER_default desktop:
bash
brew install claude-code
claude
  • Authenticate with Anthropic in the initial screen of claude.
  • Log out from the alcless_USER_default desktop.
  • Run the following commands in the main desktop:
bash
cd ~/SOME_DIRECTORY
alcless zsh -c "security unlock-keychain && claude"

[!TIP]

AI coding agents typically prints the authentication URL on the first run. Make sure to copy and paste the URL in a single line. (Hint: use TextEdit to eliminate extra line delimiters)

OpenCode

bash
cd ~/SOME_DIRECTORY
# Specify --force-bottle to avoid recompilation
alcless brew install --force-bottle opencode
alcless opencode

Ollama integration

To use a local model such as Gemma or Qwen, launch OpenCode via Ollama:

cd ~/SOME_DIRECTORY
alcless brew install --force-bottle opencode ollama
alcless ollama

Select Launch OpenCode, press →, and choose a model such as gemma4.

Install

Requirements:

  • macOS (recommended) or Linux
  • Go

To install Alcoholless, run:

bash
make
sudo make install

Makefile variables:

  • PREFIX: installation prefix (default: /usr/local)

Usage

To initialize the "default" sandbox (user account alcless_${USER}_default):

alclessctl create default

To run a command:

alclessctl shell default -- brew install xz

or

alcless brew install xz

To run a command, without rsyncing the current directory:

alclessctl shell --plain default bash

or

alcless --plain bash

To remove the sandbox:

alclessctl delete default

To remove the sandbox, while keeping the home directory of the sandbox user (/Users/alcless_${USER}_default):

alclessctl delete --keep-home default

The command line is designed to be similar to limactl.

How it works

Just plain old utilities under the hood: sudo, su, pam_launchd, and rsync.

A future version may also incorporate FSKit to replace rsync.

Security notice

Alcoholless creates /etc/sudoers.d/alcless_exampleuser_default for the user exampleuser, with the following content:

exampleuser ALL=(root) NOPASSWD: /usr/bin/su - alcless_exampleuser_default -c *

This sudo configuration allows exampleuser to run /usr/bin/su - alcless_exampleuser_default -c * as the root user, without the password.

The su command being executed through sudo can run an arbitrary command as the sandbox user alcless_exampleuser_default.

See FAQs for the reason why su is wrapped inside sudo.


Advanced information

FAQs

Why wrap su inside sudo?

Because sudo doesn't isolate "a specific Mach bootstrap subset, audit session and other characteristics not recognized by POSIX" (see launchd(8)) on macOS, while su isolates them.

e.g., sudo -u alcless_exampleuser_default open -a TextEdit opens the TextEdit application as the current user, not as alcless_exampleuser_default.

This issue could be solved by copying the pam_launchd.so configuration from /etc/pam.d/su to /etc/pam.d/sudo, however, touching such system configuration files might be scary.

So, the current workaround is to just wrap su inside sudo.

Why not use containers?

Because containers are not supported on macOS.

Why not use VM?

Because VM has several disadvantages:

  • Non-negligible performance overhead
  • High disk consumption
  • No direct access to the host hardware (GPU, etc.)
  • Localhost address inaccessible from the host
  • Does not work on GitHub Actions etc. due to lack of the support for nested virtualization
  • Licensing limitations apply for macOS guests (e.g., only 2 guests can be runnable at most)

How does Alcoholless relate to Lima?

  • Alcoholless (Lightweight): run commands as a separate user (not a VM, nor a container)
  • Lima (Strong security): run commands in a VM (Linux, macOS, etc.)

The alclessctl CLI is designed to mimic the limactl CLI for an easier learning, however, Alcoholless does not use Lima under the hood.

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Go

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月18日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言