Skip to main content

Add Homebrew's shell environment to xonsh shell on macOS/Linux
(alternative to shellenv).

If you like the idea click ⭐ on the repo and tweet. This might also accelerate adding xonsh support to Homebrew.

Introduction

Homebrew has a shellenv command to add its environment to your shell: it adds a few environment variables (HOMEBREW_ PREFIX/CELLAR/REPOSITORY) and updates a few paths (MAN/INFO/ PATH).

This xontrib automatically translates the default bash export statements of shellenv into xonsh.

Installation

To install use pip:

xpip install xontrib-homebrew
# or: xpip install -U git+https://github.com/eugenesvk/xontrib-homebrew

This xontrib will get loaded automatically for interactive sessions; to stop this, set

$XONTRIBS_AUTOLOAD_DISABLED = {"homebrew", }

Usage

Add this to your xonsh run control file (~/.xonshrc or ~/.config/rc.xsh):

xontrib load homebrew

Set custom Homebrew installation path via $XONTRIB_HOMEBREW_PATHBREW to /full/path/to/bin/brew if it's not installed at these default paths (which always take precedence):

macOS Linux
/usr/local/bin/brew /home/linuxbrew/.linuxbrew/bin/brew
/opt/homebrew/bin/brew ~/.linuxbrew/bin/brew

Set the level of verbosity via $XONTRIB_HOMEBREW_LOGLEVEL to 0–3 (default 1):

  • 0 print nothing (fail silently)
  • 1 print errors (e.g. can't find brew at default locations)
  • 2 print warnings (e.g issues when parsing shellenv)
  • 3 print more verbose messages

Known issues

  • Xontrib autoload currently can't be disabled due to a xonsh bug, so if you need precise control over when your environment variables are set (e.g., whether /path/to/homebrew/bin is at the top of PATH), try installing from a deauto branch:
    xpip install -U git+https://github.com/eugenesvk/xontrib-homebrew@deauto
  • Likely due to the same bug your $XONTRIB_HOMEBREW_PATHBREW and $XONTRIB_HOMEBREW_LOGLEVEL env vars might be ignored in the autoloaded version, so install the @deauto version mentioned above

Credits

This package was created with xontrib cookiecutter template.

Release files for xontrib-homebrew 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for xontrib-homebrew 0.2.1
File Size Uploaded
xontrib_homebrew-0.2.1.tar.gz 4.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for xontrib-homebrew 0.2.1
File Interpreter ABI Platform
xontrib_homebrew-0.2.1-py3-none-any.whl Python 3 none any Details

Total release size: 9.7 kB

Release files / xontrib_homebrew-0.2.1.tar.gz

Download URL xontrib_homebrew-0.2.1.tar.gz
Size 4.8 kB
Tags Source
SHA-256 checksum
How to use checksums
24a29d2c4ed27bef86acdef4d98a95254b2ad1efefae7037aed298f13713f020
BLAKE2b-256 checksum
How to use checksums
ae1fcc27cd30bff964af80077b0a829fd0788fa6dcb1a02a71a34d3ff368ca0a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.1

Release files / xontrib_homebrew-0.2.1-py3-none-any.whl

Download URL xontrib_homebrew-0.2.1-py3-none-any.whl
Size 4.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
498b30848eaaaab5b92cb9a7c571bc6303d7b40d40fe17217584defe46edde77
BLAKE2b-256 checksum
How to use checksums
76d4f5f5f30e163d403f703ebe47e27ccc06fd18f21dfa90549d8a00f7256a17
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.1

Release history Release notifications | RSS feed

This release

0.2.1 This release

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page