I generally manage all software on my mac - both CLI and graphical - using Homebrew^. This has a number of benefits:
=> Homebrew
That said, sometimes I need a package that either doesn't exist in the brew
package tree, or it does exist but is not configured in the way that I want. This recently happened to me, as I wanted to try out the w3m^ text-based web browser with sixel^ support.
A few steps are required to get this working. First, we need to install libsixel^ to give us the img2sixel
binary, which is responsible for converting images to sixels. Then, we need to compile w3m
with image support. Finally, we need a terminal emulator that supports sixels. My terminal of choice (iTerm2) does and many others^ support it as well. Unfortunately, there is no tmux
support yet but if you're brave, there is a tmux fork^ with sixel support.
=> libsixel | many others | tmux fork
Libsixel is available as a homebrew package so that's a quick install but the brew-provided w3m package doesn't come with sixel image support. In those cases, where something in brew isn't as you prefer, you can generally do one of two things:
brew edit <package>
to edit the brew Formula and then reinstall the modified package
Both come with pros and cons. The brew edit
route keeps everything as a brew package but leaves you with a local change in the package tree. Then, every time you run brew update
and there is an update for the modified package, brew will ask if you want to keep the changes or overwrite them. There are ways around this (one of them is to fork the package tree and put your changes in a separate branch) but none of them are really user-friendly. Things like this are a lot easier with Gentoo's portage^, for example.
That is why I chose the latter and prefer to compile things from source. It gives me a bit more flexibility, while still making use of the brew-managed libraries and build environment. To do this, however, we do need to jump through a few hoops.
I first pulled w3m from source:
$ git clone https://github.com/tats/w3m $ cd w3m
Then, we need to import the brew environment into our existing shell. You could do this manually but luckily, there is brew sh
, which will do all of this (environment variables, compiler flags, etc) for you.
Once we're in the brew environment, we need to compile against brew, potentially using brew libs where needed. In my case, I set the prefix and added support for ssl using the brew-provided openssl library. Again, brew has us covered with brew --prefix
. From there on, it's just a simple make
and make install
to finish things:
$ brew sh $ ./configure --prefix=$(brew --prefix) --enable-image \ --with-ssl=$(brew --prefix openssl@1.1) $ make $ make install
Finally to test everything, just run w3m -sixel
. Additional parameters can optionally be passed along with the W3M_IMG2SIXEL
env var:
$ W3M_IMG2SIXEL="$(brew --prefix)/bin/img2sixel -d atkinson" \ w3m -sixel -o display_image=1 \ "https://cyberscoop.com/boston-l0pht-hackers-tech-scene/"
So we get those sweet, sweet images in our terminal:
!w3m with sixel support^
=> Reply via email: ghostzero@ghostze.ro
⁂
=> Back This content has been proxied by September (3851b).Proxy Information
text/gemini